Merge pull request #959 from kattni/expand-if-else

Expand if/else.
This commit is contained in:
Kattni 2019-12-10 15:13:04 -05:00 committed by GitHub
commit 9696dddea8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -87,7 +87,10 @@ while True:
time.sleep(0.05) # Debounce.
if cpb.switch is not last_switch_state: # If the switch state is changed...
last_switch_state = cpb.switch # Set state to current switch state.
print("Switch is to the", "left: LEDs off!" if cpb.switch else "right: LEDs on!")
if cpb.switch:
print("Switch is to the left: LEDs off!")
else:
print("Switch is to the right: LEDs on!")
# Send a BUTTON_1 button packet.
if not send_packet(uart_connection,
ButtonPacket(ButtonPacket.BUTTON_1, pressed=cpb.switch)):