Expand if/else.
This commit is contained in:
parent
d13eb41408
commit
6385ea09d2
1 changed files with 4 additions and 1 deletions
|
|
@ -87,7 +87,10 @@ while True:
|
||||||
time.sleep(0.05) # Debounce.
|
time.sleep(0.05) # Debounce.
|
||||||
if cpb.switch is not last_switch_state: # If the switch state is changed...
|
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.
|
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.
|
# Send a BUTTON_1 button packet.
|
||||||
if not send_packet(uart_connection,
|
if not send_packet(uart_connection,
|
||||||
ButtonPacket(ButtonPacket.BUTTON_1, pressed=cpb.switch)):
|
ButtonPacket(ButtonPacket.BUTTON_1, pressed=cpb.switch)):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue