Just making a simple code where a single motor with a jaguar will run for 5 seconds then stop.
What code would I use to execute this? I get to calling up the code then getting the output, but I can’t add a time and inputs for power.
Just making a simple code where a single motor with a jaguar will run for 5 seconds then stop.
What code would I use to execute this? I get to calling up the code then getting the output, but I can’t add a time and inputs for power.
For a timed action you can put the code in Periodic Tasks.vi.
With a state-machine you could put code in Teleop.vi
There are lots of different ways to do something like this.
Here’s an example that could be used in Teleop.vi
You’d add your Set Motor in the True case, and add another case outside to the right that used Time to do it? as a flag to stop the motor.
This example for Periodic Tasks.vi would just need the two sequence frames that do the Motor sets to start, then stop the motor.
Ignore the Servo stuff. They were demonstrating extra actions.
What about in Autonomous period? With two motors you can attach a timer to have a motor running for x amount of seconds, but you can’t attach the timer to a One motor item.
WPI Robotics Library -> Robot Drive -> Advanced is the location of said timer.