Need help with flowcode

Thread Starter

gaber2611

Joined Mar 14, 2013
324
Hello
I'm beginner with flow code
Need simple program
If press the button, red led turn on and stay on
If button pressed again, red led off and green led on
If button pressed again both leds are off
How this can be done?
Attached flow not work right for me
Any help?
 

Attachments

MrChips

Joined Oct 2, 2009
34,812
Possible? Yes.
But it is not that complicated. You can think of it as a finite state machine with three states.

STATE RED GREEN
0-----OFF---OFF
1-----ON ---OFF
2-----OFF---ON
 

MrChips

Joined Oct 2, 2009
34,812
Actually, it is easier than that. Simply output the value of State to two output pins. Bit-0 controls the red LED, bit-1 controls the green LED.
 
Top