Controlling a LED using a Push button and Arduino Uno

Поділитися
Вставка
  • Опубліковано 19 сер 2024

КОМЕНТАРІ • 22

  • @harukills
    @harukills Рік тому +11

    You dont actually need an adruinno to do this mechanism, but i guess there's other form of uses

    • @dktechs
      @dktechs  Рік тому +7

      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.

  • @efrenvillariasa6575
    @efrenvillariasa6575 10 місяців тому +4

    Can you give me the code the one that can continues the on and off thank you

  • @Expatriate1977
    @Expatriate1977 Рік тому +2

    Thank you!

  • @Maxib226
    @Maxib226 29 днів тому

    What buttons are those?

  • @davariz
    @davariz 9 місяців тому +1

    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

    • @dktechs
      @dktechs  9 місяців тому

      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.

  • @rubiksbest171
    @rubiksbest171 Рік тому +4

    Hi.
    May I know how much resistance is that resistor?

    • @dktechs
      @dktechs  Рік тому +5

      220 ohm

    • @rubiksbest171
      @rubiksbest171 Рік тому +2

      @@dktechs thanks!

    • @dktechs
      @dktechs  Рік тому +2

      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

  • @Learningontop
    @Learningontop Рік тому +1

    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.

    • @dktechs
      @dktechs  Рік тому +1

      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

  • @prashantk6823
    @prashantk6823 9 місяців тому +1

    Which resistor use?

    • @dktechs
      @dktechs  9 місяців тому

      For pull up or pull down you use between 1k and 4.7k.

  • @efrenvillariasa6575
    @efrenvillariasa6575 10 місяців тому +1

    I follow your code but doesn't work my Arduino app

    • @dktechs
      @dktechs  10 місяців тому

      Doesn't work means it's not compiling in IDE or hardware is not working?

  • @memelate9624
    @memelate9624 Рік тому +5

    bro if u didn't use bool it cud have worked
    if(btnsts == HIGH)
    digitalWrite(ledpin,LOW)

    • @dktechs
      @dktechs  Рік тому +1

      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.

    • @memelate9624
      @memelate9624 Рік тому +2

      ​@@dktechs
      nvm
      it shud fit ur taste