View Single Post
  #1   Spotlight this post!  
Unread 10-02-2009, 15:16
Straberrie's Avatar
Straberrie Straberrie is offline
The Plague
AKA: Rebecca
FRC #0375 (Robotic Plague)
Team Role: Programmer
 
Join Date: Feb 2008
Rookie Year: 2007
Location: New York
Posts: 59
Straberrie will become famous soon enough
Digital Inputs + Auton?

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!!!
__________________
Team 375: The Robotic Plague
Current Robot: I-Chihuahua
Last Event: Big Apple Breakaway