Update references to 'controller'.
This commit is contained in:
parent
636da289ec
commit
d41c9cb385
2 changed files with 9 additions and 9 deletions
|
|
@ -24,7 +24,7 @@ STRIP_PIXEL_NUMBER = 30
|
||||||
|
|
||||||
# Setup for blink animation
|
# Setup for blink animation
|
||||||
BLINK_SPEED = 0.5 # Lower numbers increase the animation speed
|
BLINK_SPEED = 0.5 # Lower numbers increase the animation speed
|
||||||
BLINK_INITIAL_COLOR = color.RED # Color before controller is connected
|
BLINK_INITIAL_COLOR = color.RED # Color before Remote Control is connected
|
||||||
|
|
||||||
# Setup for comet animation
|
# Setup for comet animation
|
||||||
COMET_SPEED = 0.03 # Lower numbers increase the animation speed
|
COMET_SPEED = 0.03 # Lower numbers increase the animation speed
|
||||||
|
|
@ -75,7 +75,7 @@ while True:
|
||||||
animations.animate() # Run the animations.
|
animations.animate() # Run the animations.
|
||||||
if ble.connected: # If BLE is connected...
|
if ble.connected: # If BLE is connected...
|
||||||
was_connected = True
|
was_connected = True
|
||||||
if uart.in_waiting: # Check to see if any data is available from the controller.
|
if uart.in_waiting: # Check to see if any data is available from the Remote Control.
|
||||||
try:
|
try:
|
||||||
packet = Packet.from_stream(uart) # Create the packet object.
|
packet = Packet.from_stream(uart) # Create the packet object.
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|
@ -91,15 +91,15 @@ while True:
|
||||||
elif isinstance(packet, ButtonPacket): # If the packet is a button packet...
|
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)
|
# Check to see if it's BUTTON_1 (which is being sent by the slide switch)
|
||||||
if packet.button == ButtonPacket.BUTTON_1:
|
if packet.button == ButtonPacket.BUTTON_1:
|
||||||
if packet.pressed: # If controller switch is to the left...
|
if packet.pressed: # If Remote Control switch is to the left...
|
||||||
print("Controller switch is to the left: LEDs off!")
|
print("Remote Control switch is to the left: LEDs off!")
|
||||||
else: # If the controller switch is to the right...
|
else: # If the Remote Control switch is to the right...
|
||||||
print("Controller switch is to the right: LEDs on!")
|
print("Remote Control switch is to the right: LEDs on!")
|
||||||
# If the controller switch is moved from right to left...
|
# If the Remote Control switch is moved from right to left...
|
||||||
if packet.pressed and not blanked:
|
if packet.pressed and not blanked:
|
||||||
animations.fill(color.BLACK) # Turn off the LEDs.
|
animations.fill(color.BLACK) # Turn off the LEDs.
|
||||||
blanked = packet.pressed # Track the state of the slide switch.
|
blanked = packet.pressed # Track the state of the slide switch.
|
||||||
if packet.pressed: # If the buttons on the controller are pressed...
|
if packet.pressed: # If the buttons on the Remote Control are pressed...
|
||||||
if packet.button == ButtonPacket.LEFT: # If button A is pressed...
|
if packet.button == ButtonPacket.LEFT: # If button A is pressed...
|
||||||
print("A pressed: animation mode changed.")
|
print("A pressed: animation mode changed.")
|
||||||
animations.next() # Change to the next animation.
|
animations.next() # Change to the next animation.
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ while True:
|
||||||
r, g, b = map(scale, cpb.acceleration) # Map acceleration values to RGB values...
|
r, g, b = map(scale, cpb.acceleration) # Map acceleration values to RGB values...
|
||||||
color = (r, g, b) # Set color to current mapped RGB value...
|
color = (r, g, b) # Set color to current mapped RGB value...
|
||||||
print("Color:", color)
|
print("Color:", color)
|
||||||
cpb.pixels.fill(color) # Fill controller LEDs with current color...
|
cpb.pixels.fill(color) # Fill Remote Control LEDs with current color...
|
||||||
if not send_packet(uart_connection, ColorPacket(color)): # And send a color packet.
|
if not send_packet(uart_connection, ColorPacket(color)): # And send a color packet.
|
||||||
uart_connection = None
|
uart_connection = None
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue