Fixed index error, removed testArray

This commit is contained in:
Jen Fox 2018-12-12 12:11:32 -08:00
Родитель 9f8b9ecf60
Коммит acfaf85258
1 изменённых файлов: 3 добавлений и 9 удалений

Просмотреть файл

@ -21,8 +21,6 @@
#Import all of the Micro:Bit Library #Import all of the Micro:Bit Library
from microbit import * from microbit import *
testArray = [1,1,1,1] #For testing purposes only
# Setup & Config # Setup & Config
display.off() # Turns off LEDs to free up additional input pins display.off() # Turns off LEDs to free up additional input pins
uart.init(baudrate=9600) # Sets serial baud rate uart.init(baudrate=9600) # Sets serial baud rate
@ -148,7 +146,7 @@ def update_control_state():
if got_data: if got_data:
is_paused = parsedData[0] == "#pause" is_paused = parsedData[0] == "#pause"
play_infinitely = parsedData[1] == "1" play_infinitely = parsedData[1] == "1"
commandArrayRaw = parsedData[2:] commandArrayRaw = parsedData[2:10]
#=============================================================================# #=============================================================================#
@ -159,7 +157,7 @@ while (True):
update_control_state() update_control_state()
if got_data or play_infinitely: if got_data or play_infinitely:
for command_index in range(len(commandArrayRaw)-1): for command_index in range(len(commandArrayRaw)):
# Leave for loop if we're paused # Leave for loop if we're paused
if is_paused: if is_paused:
break break
@ -168,7 +166,6 @@ while (True):
intensity = ledIntensity(intensity) intensity = ledIntensity(intensity)
flashSpeed = ledFlashSpeed(flashSpeed) flashSpeed = ledFlashSpeed(flashSpeed)
#uart is the micro:bit command for serial #uart is the micro:bit command for serial
try: try:
uart.write('{}{}'.format(command_index + 1, EOL)) uart.write('{}{}'.format(command_index + 1, EOL))
@ -179,7 +176,4 @@ while (True):
ledFlashSequence(intensity, flashSpeed, ledCommandList) ledFlashSequence(intensity, flashSpeed, ledCommandList)
sleep(DATA_RATE) sleep(DATA_RATE)
update_control_state() update_control_state()