|
Re: Autonomous Photosensor Programming
In NetBeans, if you create a new FRC Project, and choose from the FRC Sample Projects, you can see one that is a line following project. If you create that project, you can see the example code. It's a bit hard to follow, but it works on the a few basic premises:
1) Using the driver station's digital inputs to choose whether to follow the straight or narrow, and whether to go left or right at the fork
2) Changing the motor's speed based on the time that has elapsed
3) Getting the values from the light sensors and storing it in an integer as a single binary string, i.e. 111 (7) is all sensors on, 000 (0) is all sensors off, 010 (2) is the middle sensor on, etc.
4) Running a switch statement based on the binary string to determine how much to turn.
Take a look through it, and if you have any questions, feel free to come back and ask.
__________________
while(!going.isTough());
tough.exit();
What will we do tonight, Warfa?
The same thing we do every night, Patrick. Sit and wait for Electrical.
|