Look into the state change detection example. The buttonPushCounter could be used to select the mode. Like 0 for deactivate the relay (off), 1 for activate the relay (on) and 2 for the other function (auto). If the count increases to 3, reset the count to 0. So the count starts at 0 (off), the next push increments to 1 (on), the next push increments to 2 (auto function) and on the next push the counter is reset to 0 (off). Use switch case, using the buttonPushCounter to select which function to do.
jokefox:
The button would be 3 presses. On, off and auto.
It is perfectly possible to write a program to act like that but I suspect a human user - including you, but especially someone who is not familiar with your "machine" will find it very confusing in practice.
For example I could interpret what you have written to mean a cycle of ON OFF AUTO ON OFF AUTO ON OFF etc. And that would mean that there is no means to go from AUTO to OFF.
And what happens if you want to go from ON to OFF and accidentally give an extra press and go to AUTO?
A three-position switch with OFF in the centre seems to me much more sensible. Or three buttons.
Robin2:
It is perfectly possible to write a program to act like that but I suspect a human user - including you, but especially someone who is not familiar with your "machine" will find it very confusing in practice.
For example I could interpret what you have written to mean a cycle of ON OFF AUTO ON OFF AUTO ON OFF etc. And that would mean that there is no means to go from AUTO to OFF.
And what happens if you want to go from ON to OFF and accidentally give an extra press and go to AUTO?
A three-position switch with OFF in the centre seems to me much more sensible. Or three buttons.
...R
i have a power bar that has a "mode" button that just cycles threw the on, off, auto , so i figured it would be a good idea, but a 3 state button sounds alot easier for my dumb ass,
i also wanted to release this code once finished, so i figured the less wierd items people had to buy the better
jokefox:
i also wanted to release this code once finished, so i figured the less wierd items people had to buy the better
That sounds like a great reason to make the user-interface simple - with a 3 position switch. As @TomGeorge has said centre off switches are very easily obtained.