diff --git a/tests/student_code/sound_device.py b/tests/student_code/sound_device.py index cc9cb825..49465235 100644 --- a/tests/student_code/sound_device.py +++ b/tests/student_code/sound_device.py @@ -1,4 +1,5 @@ # Student code that plays pitches from keyboard inputs +# Commented out print_buttons and play_notes functions as they are not run import time SOUND = '59_1' @@ -23,8 +24,8 @@ ################################## AUTONOMOUS ################################## -def autonomous_setup(): - print("Now executing AUTONOMOUS SETUP") +def autonomous(): + print("Now executing AUTONOMOUS") # Write pitches for note in NOTES: if (note == ' '): @@ -35,35 +36,30 @@ def autonomous_setup(): Robot.set_value(SOUND, "PITCH", MAP[note]) time.sleep(NOTE_DURATION) -def autonomous_main(): - pass - #################################### TELEOP #################################### -def teleop_setup(): - print("Now executing TELEOP SETUP") +def teleop(): + print("Now executing TELEOP") # Robot.run(print_button) # Robot.run(play_notes) - pass - -def teleop_main(): - if Gamepad.get_value('button_a'): - Robot.set_value(SOUND, "PITCH", MAP['C']) - print("Wrote Button A: Pitch C") - time.sleep(NOTE_DURATION); - if Gamepad.get_value('button_b'): - Robot.set_value(SOUND, "PITCH", MAP['B']) - print("Wrote Button B: Pitch B") - time.sleep(NOTE_DURATION); + while True: + if Gamepad.get_value('button_a'): + Robot.set_value(SOUND, "PITCH", MAP['C']) + print("Wrote Button A: Pitch C") + time.sleep(NOTE_DURATION); + if Gamepad.get_value('button_b'): + Robot.set_value(SOUND, "PITCH", MAP['B']) + print("Wrote Button B: Pitch B") + time.sleep(NOTE_DURATION); ################################### THREADS #################################### -def print_button(): - while (1): - if Gamepad.get_value('button_a'): - print("BUTTON A IS PRESSED") - if Gamepad.get_value('button_b'): - print("BUTTON B IS PRESSED") +# def print_button(): +# while (1): +# if Gamepad.get_value('button_a'): +# print("BUTTON A IS PRESSED") +# if Gamepad.get_value('button_b'): +# print("BUTTON B IS PRESSED") # def play_notes(): # while (1): diff --git a/tests/student_code/tc_212_a.py b/tests/student_code/tc_212_a.py index df235457..6f003897 100644 --- a/tests/student_code/tc_212_a.py +++ b/tests/student_code/tc_212_a.py @@ -6,15 +6,10 @@ DEVICE = "62_1" PARAM = "MY_INT" -def autonomous_setup(): +def autonomous(): pass -def autonomous_main(): - pass - -def teleop_setup(): - pass - -def teleop_main(): - Robot.set_value(DEVICE, PARAM, 999) +def teleop(): + while True: + Robot.set_value(DEVICE, PARAM, 999) diff --git a/tests/student_code/tc_212_b.py b/tests/student_code/tc_212_b.py index 1951da90..43990b1f 100644 --- a/tests/student_code/tc_212_b.py +++ b/tests/student_code/tc_212_b.py @@ -7,16 +7,12 @@ DEVICE = "62_1" PARAM = "MY_INT" -def autonomous_setup(): +def autonomous(): pass -def autonomous_main(): - pass - -def teleop_setup(): +def teleop(): Robot.set_value(DEVICE, PARAM, 999) - -def teleop_main(): - if Keyboard.get_value('w'): - Robot.set_value(DEVICE, PARAM, 1000) + while True: + if Keyboard.get_value('w'): + Robot.set_value(DEVICE, PARAM, 1000) \ No newline at end of file diff --git a/tests/student_code/tc_212_c.py b/tests/student_code/tc_212_c.py index a58a563e..c29a0aec 100644 --- a/tests/student_code/tc_212_c.py +++ b/tests/student_code/tc_212_c.py @@ -6,17 +6,12 @@ DEVICE = "62_1" PARAM = "MY_INT" -def autonomous_setup(): +def autonomous(): pass -def autonomous_main(): - pass - -def teleop_setup(): - pass - -def teleop_main(): - if Keyboard.get_value('w'): - Robot.set_value(DEVICE, PARAM, 999) - else: - Robot.set_value(DEVICE, PARAM, 111) \ No newline at end of file +def teleop(): + while True: + if Keyboard.get_value('w'): + Robot.set_value(DEVICE, PARAM, 999) + else: + Robot.set_value(DEVICE, PARAM, 111) \ No newline at end of file