|
24 | 24 |
|
25 | 25 | # Setup for blink animation |
26 | 26 | BLINK_SPEED = 0.5 # Lower numbers increase the animation speed |
27 | | -BLINK_INITIAL_COLOR = color.RED # Color before controller is connected |
| 27 | +BLINK_INITIAL_COLOR = color.RED # Color before Remote Control is connected |
28 | 28 |
|
29 | 29 | # Setup for comet animation |
30 | 30 | COMET_SPEED = 0.03 # Lower numbers increase the animation speed |
|
75 | 75 | animations.animate() # Run the animations. |
76 | 76 | if ble.connected: # If BLE is connected... |
77 | 77 | was_connected = True |
78 | | - if uart.in_waiting: # Check to see if any data is available from the controller. |
| 78 | + if uart.in_waiting: # Check to see if any data is available from the Remote Control. |
79 | 79 | try: |
80 | 80 | packet = Packet.from_stream(uart) # Create the packet object. |
81 | 81 | except ValueError: |
|
91 | 91 | elif isinstance(packet, ButtonPacket): # If the packet is a button packet... |
92 | 92 | # Check to see if it's BUTTON_1 (which is being sent by the slide switch) |
93 | 93 | if packet.button == ButtonPacket.BUTTON_1: |
94 | | - if packet.pressed: # If controller switch is to the left... |
95 | | - print("Controller switch is to the left: LEDs off!") |
96 | | - else: # If the controller switch is to the right... |
97 | | - print("Controller switch is to the right: LEDs on!") |
98 | | - # If the controller switch is moved from right to left... |
| 94 | + if packet.pressed: # If Remote Control switch is to the left... |
| 95 | + print("Remote Control switch is to the left: LEDs off!") |
| 96 | + else: # If the Remote Control switch is to the right... |
| 97 | + print("Remote Control switch is to the right: LEDs on!") |
| 98 | + # If the Remote Control switch is moved from right to left... |
99 | 99 | if packet.pressed and not blanked: |
100 | 100 | animations.fill(color.BLACK) # Turn off the LEDs. |
101 | 101 | blanked = packet.pressed # Track the state of the slide switch. |
102 | | - if packet.pressed: # If the buttons on the controller are pressed... |
| 102 | + if packet.pressed: # If the buttons on the Remote Control are pressed... |
103 | 103 | if packet.button == ButtonPacket.LEFT: # If button A is pressed... |
104 | 104 | print("A pressed: animation mode changed.") |
105 | 105 | animations.next() # Change to the next animation. |
|
0 commit comments