Hey. Admittedly I don't have too much experience programming for the new control system (I was delegated to electronics this past year), but a couple things look kind of fishy. First of all, I don't think you're supposed to be disabling the Watchdog like that. From what I remember of the documentation and example code, you should be Feed()ing it. Also, I don't think doing
and then
on the next line will make it fire. The way I see it, there are a couple ways to get this to do what you want. The first way would be to just do
Code:
turret.Set(manipulator.GetRawButton(1))
so that it fires the solenoid when you press the button. I'm assuming you're using a Festo single-solenoid valve, of course. The other way would be to write it so that when you press the button, it sets the solenoid to 1 and then starts a counter. Then, when the counter reaches 0, it sets the solenoid to 0. It could probably look like this
Code:
int shootercounter
void Pneumatics()
{
if( shootercounter > 0 )
shootercounter-- //decrement the counter
else
turret.Set(0); //close the valve
if( manipulator.GetRawButton(1) )
{
//open the valve for 200 cycles
shootercounter = 200;
turret.Set(1);
}
}
Though there's definitely a better way to do it with timers, I'm not sure how to use timers in the new system.