|
Re: A few questions on programming the Control System
Sorry, I realize my post wasn't too clear, so here is exactly what I want to do.
I simply need a way to control the solenoid with one button. In the code, you control a relay's forward/backward signal with 2 buttons (one for each). I was wondering how I could make it so 1 button could control a solenoid, where some state would change each time I hit it, sending a different signal.
Example: If I were to hit the trigger of the controller in port 1 the first time, it would cause a cylinder to open by sending the command to the solenoid. However, the next time hit this trigger, the cylinder would close. I am not sure it matters, but we will be using only double solenoids.
I want to create some sort of function which could do this, as I would need to set up quite a few for this years robot. I have been looking through the code, trying to find a way to do this succesfully for a while now, and I can't seem to do it.
My main problem is that I can't find a way to detect whether or not a trigger has been hit. I tried #if p1_sw_trig, but I got a malformed function error. If I try #if (p1_sw_trig) then it says expected ')' and malformed function...
|