Arduino Code Magic: Latching/Toggle Circuit

preview_player
Показать описание
Learn a bit more about writing to variables with functions and their opposites, while building a circuit that stays on or off until you push the button again. This is a super useful sketch that was requested at one of our meetups!
Рекомендации по теме
Комментарии
Автор

I thought if you used the INPUT_PULLUP command then we're accessing the 20K resistor in the pins?

juliusau
Автор

it didn't work for me. LED simply flashes with no response from the button. If ledPin was declared as a OUTPUT at setup, then how is it that in the main loop your code is written to digitalWrite and digitalRead ledPin simultaneously?

tomalen
Автор

if the push button is being held, the LED will start flashing.

ehdohwah
Автор

I am looking to incorporate in my project using arduino with 5 buttons to pulse the associated relay
That means that each switch will create a short single output pulse no matter how long the button is pressed
Your help will be greatly appreciated
Many thanks
Erik Hoffman
London, UK

erikhoffman
Автор

Thank you! I used this for a touch light I made for my desk!

sethlarsen
Автор

smart code... thanks a lot...:) show some more examples...

qzorn
Автор

but this isnt a perfect solution since if you hold longer or shorter than the delay, you wont get the expected result and if you hold the button down, the led starts blinking

timwalt
Автор

Thanks... I was trying to think of a way to create a on off button... I think that would work... it should be possible to use that logic to start another process I guess.

Alexseehp
Автор

Will it retain the same state after reset

TopEndTutorial
Автор

I wrote the code down, and instead of turning the LED on/off, it switches my Arduino board off.

nicholascalla
Автор

how would I go about making this work with 7 individual negative inputs that then power 7 relays...?

pawpatina