diff --git a/helper scripts/common-commands.txt b/helper scripts/common-commands.txt index 4f99f2a..cd0a02d 100644 --- a/helper scripts/common-commands.txt +++ b/helper scripts/common-commands.txt @@ -1,11 +1,15 @@ All of these commands should be run while in the directory 'C:\repos\FRC-2025\src' +winget uv install: 'winget install --exact --disable-interactivity --accept-source-agreements --accept-package-agreements --silent --id=astral-sh.uv' run once per cloned repository (git clone): 'uv tool run pre-commit' Change to the 'src' directory (i.e, Repos/FRC-2025/src): 'cd src' -sync packages: 'uv run robotpy sync' -run simulation: 'uv run robotpy sim' -deploy code: 'uv run robotpy deploy' -undeploy code: 'uv run robotpy undeploy' +create virtual environment: 'uv venv' +use virtual environment: '.venv\Scripts\activate' + +sync packages: 'uv run robotpy --main src sync' +run simulation: 'uv run robotpy --main src sim' +deploy code: 'uv run robotpy --main src deploy' +undeploy code: 'uv run robotpy --main src undeploy' diff --git a/src/robot.py b/src/robot.py index c799a6b..44cab43 100644 --- a/src/robot.py +++ b/src/robot.py @@ -1,9 +1,19 @@ import wpilib +import rev + +# step 1: define an xbox controller with the name mechCtrl and the id of 1 +# step 2: define a sparkMax motor with the ID of 1 and brushless value for type +# step 3: in teleop, make an if else statement that checks if the a button is pressed on mechCtrl +# step 4 bro: when a is pressed, set motor voltage to 1. if not pressed, set motor voltage to zero +# use wpilib docs and rev docs to find out how to define them class Robot(wpilib.TimedRobot): def robotInit(self) -> None: - pass + self.mechCtrl = wpilib.XboxController(1) + self.motor = rev.SparkMax(1, rev.SparkLowLevel.MotorType.kBrushless) + + self.motor.setVoltage(0) def robotPeriodic(self) -> None: pass @@ -12,7 +22,10 @@ def teleopInit(self) -> None: pass def teleopPeriodic(self): - pass + if self.mechCtrl.getAButton(): + self.motor.setVoltage(1) + else: + self.motor.setVoltage(0) if __name__ == "__main__":