Skip to content

Commit 0e0d077

Browse files
committed
Expand if/else
1 parent d9e09d6 commit 0e0d077

File tree

1 file changed

+5
-3
lines changed
  • Circuit_Playground_Bluefruiit_NeoPixel_Controller

1 file changed

+5
-3
lines changed

Circuit_Playground_Bluefruiit_NeoPixel_Controller/Receiver.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,11 @@
9393
elif isinstance(packet, ButtonPacket): # If the packet is a button packet...
9494
# Check to see if it's BUTTON_1 (which is being sent by the slide switch)
9595
if packet.button == ButtonPacket.BUTTON_1:
96-
print("Controller switch is to the", "left: LEDs off!" if packet.pressed
97-
else "right: LEDs on!")
98-
# If the controller switch is moved to the left...
96+
if packet.pressed: # If controller switch is to the left...
97+
print("Controller switch is to the left: LEDs off!")
98+
else: # If the controller switch is to the right...
99+
print("Controller switch is to the right: LEDs on!")
100+
# If the controller switch is moved from right to left...
99101
if packet.pressed and not blanked:
100102
animations.fill(color.BLACK) # Turn off the LEDs.
101103
blanked = packet.pressed # Track the state of the slide switch.

0 commit comments

Comments
 (0)