Hello, we are attempting to make our pneumatics work on a latch system. So we press the button, it opens, and it only closes when we press the same button again.
How can we do this? The way we thought to do this is not working. Here is some code from our program:
Basically, there is a variable “claw” that gets multiplied by -1 with each button push. Therefore, “claw” will always be either -1 or +1. The output of the pneumatics is then controlled by the variable.
“drivemode” is a variable that toggles 0 or 1, just use a similar method with a more appropriately named variable and then send that to the pneumatics.
Habit, bool is often not available as a standard type in the C language, it was added as part of the C99 standard (I think) and I started using C way before that.