Expand if/else
@@ -93,9 +93,11 @@ while True:
elif isinstance(packet, ButtonPacket): # If the packet is a button packet...
# Check to see if it's BUTTON_1 (which is being sent by the slide switch)
if packet.button == ButtonPacket.BUTTON_1:
- print("Controller switch is to the", "left: LEDs off!" if packet.pressed
- else "right: LEDs on!")
- # If the controller switch is moved to the left...
+ if packet.pressed: # If controller switch is to the left...
+ print("Controller switch is to the left: LEDs off!")
+ else: # If the controller switch is to the right...
+ print("Controller switch is to the right: LEDs on!")
+ # If the controller switch is moved from right to left...
if packet.pressed and not blanked:
animations.fill(color.BLACK) # Turn off the LEDs.
blanked = packet.pressed # Track the state of the slide switch.
