Page 1 of 1

Toggle led with button

Posted: Tue Jan 14, 2020 6:18 pm
by matt_lebe
Hello,

In school we are learning the basics of flowcode.
the teacher gave us a challenge to make a program so when i press a button the light goes on and when i press it again it goes off.
I tried to program this for 3 hours but havent found a way yet to make it work.
Can anyone help me?

Re: Toggle led with button

Posted: Tue Jan 14, 2020 6:59 pm
by Benj
Hello,

As it's a class exercise I won't do the code for you but here is some psuedocode you might use to create the program.

Light Off

Loop Start

Wait for Switch to go High
Light On
Wait for Switch to go Low

Wait for Switch to go High
Light Off
Wait for Switch to go Low

Loop End