diff --git a/.vscode/settings.json b/.vscode/settings.json index 84ba96d..c37ea16 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,9 +5,9 @@ "reportMissingModuleSource": "none" }, "python.analysis.extraPaths": [ - "c:\\Users\\origi\\.vscode\\extensions\\joedevivo.vscode-circuitpython-0.1.19-win32-x64\\boards\\0x2E8A\\0x1000", - "c:\\Users\\origi\\.vscode\\extensions\\joedevivo.vscode-circuitpython-0.1.19-win32-x64\\stubs", - "c:\\Users\\origi\\AppData\\Roaming\\Code\\User\\globalStorage\\joedevivo.vscode-circuitpython\\bundle\\20221208\\adafruit-circuitpython-bundle-py-20221208\\lib" + "c:\\Users\\origi\\.vscode\\extensions\\joedevivo.vscode-circuitpython-0.1.20-win32-x64\\boards\\0x2E8A\\0x1000", + "c:\\Users\\origi\\.vscode\\extensions\\joedevivo.vscode-circuitpython-0.1.20-win32-x64\\stubs", + "c:\\Users\\origi\\AppData\\Roaming\\Code\\User\\globalStorage\\joedevivo.vscode-circuitpython\\bundle\\20230330\\adafruit-circuitpython-bundle-py-20230330\\lib" ], "circuitpython.board.version": "7.1.0", "circuitpython.board.vid": "0x2E8A", diff --git a/SampleCode/sample_miscellaneous.py b/SampleCode/sample_miscellaneous.py index 5015fbd..2329def 100755 --- a/SampleCode/sample_miscellaneous.py +++ b/SampleCode/sample_miscellaneous.py @@ -27,12 +27,12 @@ def test_leds(): while brightness > 0: led.set_brightness(brightness) led.set_color(255,0,0) - time.sleep(0.5) + time.sleep(0.33) led.set_color(0,255,0) - time.sleep(0.5) + time.sleep(0.33) led.set_color(0,0,255) - time.sleep(0.5) - brightness -= 0.25 + time.sleep(0.33) + brightness -= 0.5 led.set_color(0,0,0) led.set_brightness(0) @@ -51,17 +51,23 @@ def ivp(): print(f"Left Reflectance: {reflectance.get_left()}, Right Reflectance: {reflectance.get_right()}") time.sleep(0.1) while (buttons.is_GP20_pressed() or buttons.is_GP21_pressed()): + # Wait until user to release button before continuing time.sleep(.01) while not buttons.is_GP20_pressed() and not buttons.is_GP21_pressed(): print(f"Ultrasonic Distance: {sonar.get_distance()}") time.sleep(0.1) while (buttons.is_GP20_pressed() or buttons.is_GP21_pressed()): + # Wait until user to release button before continuing time.sleep(.01) print("Testing Servo") test_servo() print("Testing LEDs") wait_for_button() test_leds() + print("Testing Motor Encoders:") + while not buttons.is_GP20_pressed() and not buttons.is_GP21_pressed(): + print(f"Left: {drivetrain.get_left_encoder_position()}, Right: {drivetrain.get_right_encoder_position()}") + time.sleep(0.1) print("Testing Drivetrain:") wait_for_button() test_drive() diff --git a/WPILib/WPILib.py b/WPILib/WPILib.py index 0f8c68f..cb97b4f 100755 --- a/WPILib/WPILib.py +++ b/WPILib/WPILib.py @@ -1,11 +1,11 @@ import board as _board -from _drivetrain import Drivetrain -from _encoded_motor import EncodedMotor -from _ultrasonic_wrapper import Ultrasonic -from _reflectance_wrapper import Reflectance -from _servo import Servo -from _buttons import Buttons -from _led import RGBLED +from ._drivetrain import Drivetrain +from ._ultrasonic_wrapper import Ultrasonic +from ._reflectance_wrapper import Reflectance +from ._servo import Servo +from ._buttons import Buttons +from ._encoded_motor import EncodedMotor +from ._led import RGBLED import time diff --git a/code.py b/code.py index 0d9cdda..be8bb62 100755 --- a/code.py +++ b/code.py @@ -4,5 +4,9 @@ from SampleCode.sample_miscellaneous import * from SampleCode.sample_sensor_access import * -ivp() - +def main(): + # + # Your Code Here! + # + ivp() +main() \ No newline at end of file