AndrewD
29-09-2011, 16:34
Hello all,
I'm trying to read buttons from the cypress board to fire relays on the 'bot.
My code so far (just for the relays and dsio) is:
class RobotDemo : public SimpleRobot
{
Relay barrel1;
Relay barrel2;
Relay barrel3;
DriverStation ds;
public:
RobotDemo(void):
barrel1(3),
barrel2(4),
barrel3(5),
ds()
{
GetWatchdog().SetExpiration(0.1);
}
void OperatorControl(void)
{
GetWatchdog.SetEnabled(true);
while (IsOperatorControl())
{
GetWatchdog().Feed();
if (ds.GetDigitalIn(3)) {
barrel1.Set(Relay::kOn)
} else {
barrel1.Set(Relay::kOff)
}
}
}
}
of course there is more code for the drive train but this is all that needs help. i need to know what to put in the parentheses for "ds()" under "RobotDemo(void):"
Thanks in advance,
Andrew D.
I'm trying to read buttons from the cypress board to fire relays on the 'bot.
My code so far (just for the relays and dsio) is:
class RobotDemo : public SimpleRobot
{
Relay barrel1;
Relay barrel2;
Relay barrel3;
DriverStation ds;
public:
RobotDemo(void):
barrel1(3),
barrel2(4),
barrel3(5),
ds()
{
GetWatchdog().SetExpiration(0.1);
}
void OperatorControl(void)
{
GetWatchdog.SetEnabled(true);
while (IsOperatorControl())
{
GetWatchdog().Feed();
if (ds.GetDigitalIn(3)) {
barrel1.Set(Relay::kOn)
} else {
barrel1.Set(Relay::kOff)
}
}
}
}
of course there is more code for the drive train but this is all that needs help. i need to know what to put in the parentheses for "ds()" under "RobotDemo(void):"
Thanks in advance,
Andrew D.