Closed
Description
the code i used instead was:
import pulseio
import board
import adafruit_irremote
pulsein = pulseio.PulseIn(board.GP0, maxlen=120, idle_state=True)
decoder = adafruit_irremote.GenericDecode()
but1 = "(255, 0, 93, 162)"
while True:
pulses = decoder.read_pulses(pulsein)
print("Heard", len(pulses), "Pulses:", pulses)
try:
code = decoder.decode_bits(pulses)
codestr = str(code)
print("Decoded:", code)
if codestr == but1:
print('uwu')
else:
print('no')
except adafruit_irremote.FailedToDecode: # unusual short code!
print("NEC repeat!")
continue
except adafruit_irremote.IRDecodeException as e: # failed to decode
print("Failed to decodeunu: ", e.args)
continue
print("----------------------------")
i trully don't understand why changing the except made it to work (i also added a couple things to make it usefull. not good code, but does the trick) i'm kinda new to this, so if there is something needed just tell me. (i read the except from the source code and i got the example from there too.)
Metadata
Metadata
Assignees
Labels
No labels