Skip to content

change read_region() #1071

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CPX_Simon_Game/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,32 @@ def read_region(timeout=30):
while time.time() - start_time < timeout:
if cpx.touch_A1:
val = PAD_REGION['A1']
time.sleep(.3)
break
elif cpx.touch_A2:
val = PAD_REGION['A2']
time.sleep(.3)
break
elif cpx.touch_A3:
val = PAD_REGION['A3']
time.sleep(.3)
break
elif cpx.touch_A4:
val = PAD_REGION['A4']
time.sleep(.3)
break
elif cpx.touch_A5:
val = PAD_REGION['A5']
time.sleep(.3)
break
elif cpx.touch_A6:
val = PAD_REGION['A6']
time.sleep(.3)
break
elif cpx.touch_A7:
val = PAD_REGION['A7']
time.sleep(.3)
break
return val

def play_sequence(sequence):
Expand Down
2 changes: 1 addition & 1 deletion Circuit_Playground_Express_IR_Treasure_Hunt/CPX_Hunter.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# Try and decode them
try:
# Attempt to convert received pulses into numbers
received_code = tuple(decoder.decode_bits(pulses, debug=False))
received_code = tuple(decoder.decode_bits(pulses))
except adafruit_irremote.IRNECRepeatException:
# We got an unusual short code, probably a 'repeat' signal
# print("NEC repeat!")
Expand Down