I totally agree with you but here my intention was not to switch on and off a LED you can do this without any switch or push button also,here my intention was to read a digital input and control digital output, that's all.
Estou tentando achar um codigo que eu teria que clicar uma quantidade de vezes no butao (dentro de um espaco de tempo) para o led acender por uma quantidade de tempo
You have to use timer and counter to achieve this.When button pressed increment counter by 1 as well as read timer value. Say if you want to turn ON LED for 5 seconds when two times button pressed in one second then if you counter value is two in one second turn ON LED and run timer for 5 seconds after 5 seconds turn OFF LED.
You can use any values between 150 and 400 to protect your LED from high current if you want to explore more about LED resistor you can checkout this video ua-cam.com/video/SIVfg30_KcU/v-deo.html
So many ways to perform this one of them you can use a timer when you press a button start 30 seconds timer and make output High and stop reading button,when 30 seconds timer stopped you can make output low and start reading button.For this you use a flag to keep track of time or timer ISR
Bro I didn't get you... Any logic in c or c++ you can write in thousands way... What I wanted accordingly I achieved my target and whatever I wrote in code you can write in hundreds ways. But sorry bro exactly I am not getting what do you want to say.
You dont actually need an adruinno to do this mechanism, but i guess there's other form of uses
I totally agree with you but here my intention was not to switch on and off a LED you can do this without any switch or push button also,here my intention was to read a digital input and control digital output, that's all.
Can you give me the code the one that can continues the on and off thank you
Thank you!
😊
What buttons are those?
Estou tentando achar um codigo que eu teria que clicar uma quantidade de vezes no butao (dentro de um espaco de tempo) para o led acender por uma quantidade de tempo
You have to use timer and counter to achieve this.When button pressed increment counter by 1 as well as read timer value. Say if you want to turn ON LED for 5 seconds when two times button pressed in one second then if you counter value is two in one second turn ON LED and run timer for 5 seconds after 5 seconds turn OFF LED.
Hi.
May I know how much resistance is that resistor?
220 ohm
@@dktechs thanks!
You can use any values between 150 and 400 to protect your LED from high current if you want to explore more about LED resistor you can checkout this video ua-cam.com/video/SIVfg30_KcU/v-deo.html
Sir I want that when my button press for how many time no matter but by output will turn off after 30 second so what I do.
So many ways to perform this one of them you can use a timer when you press a button start 30 seconds timer and make output High and stop reading button,when 30 seconds timer stopped you can make output low and start reading button.For this you use a flag to keep track of time or timer ISR
Which resistor use?
For pull up or pull down you use between 1k and 4.7k.
I follow your code but doesn't work my Arduino app
Doesn't work means it's not compiling in IDE or hardware is not working?
bro if u didn't use bool it cud have worked
if(btnsts == HIGH)
digitalWrite(ledpin,LOW)
Bro I didn't get you...
Any logic in c or c++ you can write in thousands way...
What I wanted accordingly I achieved my target and whatever I wrote in code you can write in hundreds ways.
But sorry bro exactly I am not getting what do you want to say.
@@dktechs
nvm
it shud fit ur taste