Attaching any Switch or Button to Arduino Microcontrollers!

Поделиться
HTML-код
  • Опубликовано: 4 окт 2024
  • Learn how to attach any switch or button to any microcontroller including Arduino and Raspberry Pi.
    Video goes through a universal circuit and code that will work for any button or switch, including: toggle switches, latching switches, arcade buttons, water proof buttons, illuminated buttons and dip switches.

Комментарии • 16

  • @dontaddmehobo
    @dontaddmehobo Месяц назад +1

    you're a godsend. thanks for actually explaining everything!

  • @DanLucas442
    @DanLucas442 2 месяца назад +1

    thanks for sharing!
    you saved me!

  • @mikecoster2709
    @mikecoster2709 6 месяцев назад +2

    I was looking at getting a spring loaded toggle switch, but the only ones I found were 125v/250v. Am I correct in thinking these won’t work with an arduino? Or is that just the maximum voltage that can run to it.

    • @adamjerozolim800
      @adamjerozolim800  6 месяцев назад +6

      yes, they are all fine. the voltage rating is the maximum. we are only using 5V. a switch is just a device that connects two wires together.

  • @lemledje9485
    @lemledje9485 13 дней назад

    I need to turn on and off a red light a buzzer and a motor with a switch without a code. I had a lot of problems with that. Everything work separate but when i connect the arduino with a code (involving a gaz sensor) everything keeps turning on even if the switch is off and the sensor didn't sens anything.
    Please can you help me i have a presentation at the end of this week

  • @rufustoad1
    @rufustoad1 6 месяцев назад +1

    Excellent. I got mine working FINALLY thanks to this video. Have you thought about another video with 3 or 4 switches turning on 3 or 4 different lights and how to make code for that? Seems that if a guy could figure out a few of those switches it would be endless on what you could add including limit switches. OR would you just copy this and add several different pinModes etc?

    • @adamjerozolim800
      @adamjerozolim800  6 месяцев назад

      correct this is the basis for almost any device, buttons and switches. adding more would just be repeating this exact circuit and code. you have to add PINMODE for each pin you are using, and a separate circuit for each button/switch

  • @htheh7728
    @htheh7728 Месяц назад +1

    Thanks alot

  • @rufustoad1
    @rufustoad1 6 месяцев назад

    WOW This is exactly what I was looking for. Can you use this same type of code for multiple pins? I am new to code and trying to set up something that would be more advanced. Can you tie the 1 pull down resistor to several input pins? Do you do any teaching on Arduino?

    • @adamjerozolim800
      @adamjerozolim800  6 месяцев назад

      yes, but you have to write PINMODE and DIGITALREAD separately for each pin. you need a separate resistor for each button otherwise one button could end up switching all of the pins HIGH. I work at CIJE and we develop STEM curriculum.

    • @rufustoad1
      @rufustoad1 6 месяцев назад

      @@adamjerozolim800Thank you for the reply. Is there a limit on the number of switches you can use on 1 ground pin?

    • @adamjerozolim800
      @adamjerozolim800  6 месяцев назад

      @@rufustoad1No, you can use as many as you like on the same ground pin, but each switch must have it's own resistor going to ground. each switch can be connected to the same 5V port. and each switch should go to a separate digital pin.

    • @rufustoad1
      @rufustoad1 6 месяцев назад +1

      @@adamjerozolim800Thankyou Adam you have been very very helpful. Hope to see an few more videos for beginners!!

  • @hetori9918
    @hetori9918 7 месяцев назад

    hi teach‘,is that wire connected from D2 to the ground called pull down resistor?

    • @adamjerozolim800
      @adamjerozolim800  7 месяцев назад +1

      yes the resistor is called a pull-down because it pulls the digital pin (D2) down to ground (0 volts)