Ce programme permet d'afficher l'heure sur 1 à 6 afficheur jumbo (au choix). Par défaut, l'heure est affichée sur 6 digits ( HH MM SS). Si vous n'en n'avez pas 6, il suffit de changer les adresses des digits dans le programme, de façon ultra simple!!!
Source / Exemple :
Sub strobe()
commandstring = Chr$(13) & Chr$(0) & "S" & Chr$(0) & Chr$(160)
Comm.Output = commandstring
End Sub
Private Sub Check5_Click()
'diminue l'intensitée des digits / ou l'augmente
If Check5.Value = 1 Then
checksum = 256 - (13 + 0 + 73 + 255) Mod 256
commandstring = Chr$(13) & Chr$(0) & Chr$(73) & Chr$(255) & Chr$(checksum)
Comm.Output = commandstring
Else
checksum = 256 - (13 + 0 + 73 + 0) Mod 256
commandstring = Chr$(13) & Chr$(0) & Chr$(73) & Chr$(0) & Chr$(checksum)
Comm.Output = commandstring
Call strobe
End If
End Sub
Private Sub Command1_Click()
If Comm.PortOpen = True Then Comm.PortOpen = False
Comm.CommPort = ncom.Text
Comm.Settings = "2400,N,8,1"
Comm.PortOpen = True
End Sub
Private Sub Command2_Click()
addr1 = addr1.Text
addr2 = addr2.Text
addr3 = addr3.Text
addr4 = addr4.Text
addr5 = addr5.Text
addr6 = addr6.Text
End Sub
Private Sub Form_Load()
ncom.Text = 7
addr1.Text = 1
addr2.Text = 2
addr3.Text = 3
addr4.Text = 4
addr5.Text = 5
addr6.Text = 6
addr1 = addr1.Text
addr2 = addr2.Text
addr3 = addr3.Text
addr4 = addr4.Text
addr5 = addr5.Text
addr6 = addr6.Text
If Comm.PortOpen = True Then Comm.PortOpen = False
Comm.CommPort = ncom.Text
Comm.Settings = "2400,N,8,1"
Comm.PortOpen = True
End Sub
Private Sub mnu_quit_Click()
Timer1.Enabled = False
checksum = 256 - (13 + 0 + 66 + (0) Mod 256)
commandstring = Chr$(13) & Chr$(0) & Chr$(66) & Chr$(0) & Chr$(checksum)
Comm.Output = commandstring
Call strobe
Comm.PortOpen = False
End
End Sub
Private Sub Timer1_Timer()
Timer1.Enabled = False
heure = Time
h1 = Mid(heure, 1, 1)
h2 = Mid(heure, 2, 1)
m1 = Mid(heure, 4, 1)
m2 = Mid(heure, 5, 1)
s1 = Mid(heure, 7, 1)
s2 = Mid(heure, 8, 1)
Label2.Caption = heure
'envoit le premier chiffre des heures
checksum = 256 - (13 + (addr1) + 65 + (Asc(h1)) Mod 256)
commandstring = Chr$(13) & Chr$(addr1) & Chr$(65) & Chr$(Asc(h1)) & Chr$(checksum)
Comm.Output = commandstring
'envoit le 2 chiffre des heures
checksum = 256 - (13 + (addr2) + 65 + (Asc(h2)) Mod 256)
commandstring = Chr$(13) & Chr$(addr2) & Chr$(65) & Chr$(Asc(h2)) & Chr$(checksum)
Comm.Output = commandstring
'envoit le premier chiffre des minutes
checksum = 256 - (13 + (addr3) + 65 + (Asc(m1)) Mod 256)
commandstring = Chr$(13) & Chr$(addr3) & Chr$(65) & Chr$(Asc(m1)) & Chr$(checksum)
Comm.Output = commandstring
'envoit le deuxième chiffre des heures
checksum = 256 - (13 + (addr4) + 65 + (Asc(m2)) Mod 256)
commandstring = Chr$(13) & Chr$(addr4) & Chr$(65) & Chr$(Asc(m2)) & Chr$(checksum)
Comm.Output = commandstring
'envoit le premier chiffre des secondes
checksum = 256 - (13 + (addr5) + 65 + (Asc(s1)) Mod 256)
commandstring = Chr$(13) & Chr$(addr5) & Chr$(65) & Chr$(Asc(s1)) & Chr$(checksum)
Comm.Output = commandstring
'envoit le deuxième chiffre des secondes
checksum = 256 - (13 + (addr6) + 65 + (Asc(s2)) Mod 256)
commandstring = Chr$(13) & Chr$(addr6) & Chr$(65) & Chr$(Asc(s2)) & Chr$(checksum)
Comm.Output = commandstring
Call strobe 'raffraichit les digits
Timer1.Enabled = True
End Sub
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.