Go Down

Topic: Do something once when switch closed, then blink LED until switch opened (Read 1 time) previous topic - next topic

Nick Gammon


If you post you code, the "experts" will come   :)


Definition of an expert:

X - unknown
spurt - a drip under pressure

Paul J



If you post you code, the "experts" will come   :)


Definition of an expert:

X - unknown
spurt - a drip under pressure


Slightly different to the one I've heard here in the UK: "X" (as in "ex-") = has been. Same definition for spurt :)

spcomputing



If you post you code, the "experts" will come   :)


Definition of an expert:

X - unknown
spurt - a drip under pressure


Or...

"An expert is a person who has made all the mistakes that can be made in a very narrow field." - Niels Bohr

I keep on making new ones, so I must defer...

spruce_m00se

I , in my non expert opinion would do the following,

use an if statement to react to the switch being pressed,
the first thing in the IF is the tone function to get a beep effect,

then within the IF statement, go into a WHILE, which will run the before mentioned blinkwithoutdelay code,

for example,

if (switch==HIGH){
tone (buzzerpin, tone frequency , 20)
          while (switch==HIGH){
           blinkwithoutdelay()
               }
}


im not sure but it could work out well

Nick Gammon


Go Up