Simultan korrigiert
This commit is contained in:
parent
142c62852c
commit
a4307e767a
|
@ -14,24 +14,30 @@ SoundFF = pygame.mixer.Sound('ogg/F#3v16.ogg')
|
||||||
|
|
||||||
# port = serial.Serial("/dev/ttyS0", baudrate=115200, timeout=.001)
|
# port = serial.Serial("/dev/ttyS0", baudrate=115200, timeout=.001)
|
||||||
port = serial.Serial("/dev/ttyS0", baudrate=115200)
|
port = serial.Serial("/dev/ttyS0", baudrate=115200)
|
||||||
|
# port = serial.Serial("/dev/ttyAMA0", baudrate=115200)
|
||||||
|
|
||||||
SoundA.play();
|
SoundA.play();
|
||||||
|
oldrcv = port.read()
|
||||||
while True:
|
while True:
|
||||||
# rcv decodieren
|
# rcv decodieren
|
||||||
rcv = port.read()
|
rcv = port.read()
|
||||||
|
|
||||||
|
# Zustand merken, und nur "neu" starten, wenn sich etwas von 0 auf 1 veraendert hat.
|
||||||
if rcv[0] & ( 1 << 1 ) :
|
if rcv[0] & ( 1 << 1 ) :
|
||||||
print("1");
|
if not oldrcv[0] & ( 1 << 1 ):
|
||||||
SoundC.stop()
|
print("1");
|
||||||
SoundC.play()
|
SoundC.stop()
|
||||||
|
SoundC.play()
|
||||||
else:
|
else:
|
||||||
SoundC.stop()
|
SoundC.stop()
|
||||||
|
rcvstate0 = False
|
||||||
|
|
||||||
if rcv[0] & ( 1 << 0 ) :
|
if rcv[0] & ( 1 << 0 ) :
|
||||||
print("0");
|
if not oldrcv[0] & ( 1 << 0 ):
|
||||||
SoundA.stop()
|
print("0");
|
||||||
SoundA.play()
|
SoundA.stop()
|
||||||
|
SoundA.play()
|
||||||
else:
|
else:
|
||||||
SoundA.stop()
|
SoundA.stop()
|
||||||
|
|
||||||
|
oldrcv = rcv
|
||||||
|
|
Loading…
Reference in New Issue