Hey,
I was trying to get different autons based on switches, and the code is as follows (example):
Quote:
void Autonomous(void)
{
if (s1->Get())
{
myRobot->Drive(-0.6, 0.5);
Wait(1.0);
myRobot->Drive(0.0,0.0);
}
else
{
myRobot->Drive(0.0,0.0);
}
}
|
and i defined the s1:
Quote:
DigitalInput *s1;
s1 = new DigitalInput(1);
|
However, when when i ran the auton, it went according to the code inside the if statement even when the switch was off. I was hoping that when the switch was off, it would refer to the "else" part of the code, but the code did not change despite the switch being off or on. What did i do wrong??
THANK YOU!!!
