Quote:
|
Originally Posted by CharlieWilken
So my last question is how to I put a switch on my digital inputs so that I have one that turns left and one that turns right etc. I imagine it is some sort of If statement but I dont know how to put all the brackets, parenthesis etc
|
What do you mean by turns left and turns right? If you are saying that these switches are telling the robot which side of the field it is starting on/you want it to start off going straight if both switches are off (IE one switch on is right, other switch on is left, and both off is straight, do something like:
Code:
if(dig_in_10 == 1)
{
// Right Mode
}
else if(dig_in_ 11 == 1)
{
// Left mode
}
else
{
// Straight mode
}
Quote:
|
Originally Posted by CharlieWilken
and do i put the counter in each automous module?
each of my autonomous modes has three states, forwardstate
turnstate and forwardshortstate. How do I group these together with regards to brackets, parenthesis into autonomous_1 and autonomous_2?
thanks again!!!
|
You just need to put it where it is being called no matter what autonomous mode you are in, so if that means calling it from multiple places, do it. Put it in whereever you will be sure it will be called often, no matter what mode you are in. It doesn't matter if it is called faster than the ticks are.