ça fonctionne en partie, trop fortManfraid a écrit :Je pense avoir trouver
voici le nouveau fichier chiffre.pyCode : Tout sélectionner
############################# # Définitions des nombres # et des lettres # affichables ############################# import pifacedigitalio as p class SevenSegment: # table conversion hexadecimal (row 1 = 0..9, row 2 = A..F) digits = [ 0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F, \ 0x77, 0x7C, 0x39, 0x5E, 0x79, 0x71 ] # Constructeur def __init__(self): self.p = p.PiFaceDigital() def writeDigitRaw(self, value): "Sets a digit using the raw 16-bit value" # Set the appropriate digit self.p.output_port.value = value def writeDigit(self, value): if (value > 0xF): return # Set the appropriate digit print(str(value)) self.p.output_port.value = self.digits[value] def clear(self): self.p.output_port.value = 0
Quand je presse start, ça compte
Quand je presse rev., ça décompte
ça se gate avec la variable speed+ et speed-
message d'erreur :
Code : Tout sélectionner
Valeur : 2 mode Decrementation
2
Valeur : 1 mode Decrementation
1
Valeur : 0 mode Decrementation
0
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.2/threading.py", line 740, in _bootstrap_inner
self.run()
File "compteur.py", line 28, in run
sleep(self.tc)
IOError: [Errno 22] Invalid argument
Unhandled exception in thread started by <bound method App._bootstrap of <App(Thread-1, started -1243306896)>>
Traceback (most recent call last):
File "/usr/lib/python3.2/threading.py", line 713, in _bootstrap
self._bootstrap_inner()
File "/usr/lib/python3.2/threading.py", line 789, in _bootstrap_inner
self._stop()
TypeError: 'bool' object is not callable