Quote:
Originally Posted by Alan Anderson
Examples of toggle functions are common on the Chief Delphi forums. Here's another:
Code:
:
:
static char prev_trig = 0;
static char toggle = 0;
:
if (p1_trig && !prev_trig)
{
toggle = !toggle;
}
prev_trig = p1_trig;
:
This will switch toggle from 0 to 1, or vice versa, each time the port 1 joystick trigger is depressed. You can test its value to decide what to do next.
|
Okay. Taking this code, where do I write in the relay values, if they need to be written in? Or is that done with the previous code for the relay values?