How to De-Bounce Switches on the Arduino - Ultimate Guide to the Arduino #21

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ม.ค. 2025

ความคิดเห็น • 13

  • @MartinBgelund
    @MartinBgelund ปีที่แล้ว +3

    Thanks.
    You should make an example of debouncing when using hardware interrupts. Nobody uses polling for button presses.

  • @DesertVox
    @DesertVox ปีที่แล้ว +5

    The simplest software debouncing is done using just a delay of about 50 ms. If the digitalRead after that delay is a LOW (assuming the push button is pulled HIGH), then the button has been pressed. But to even further simplify the code, we don't even have to do a second digitalRead. We just assume that the first trigger of the button is enough, because buttons don't get triggered out of nowhere. There has to be button press to trigger the first digitalRead. It's just two lines of code, and that's it, debouncing done!

    • @reyhurm
      @reyhurm ปีที่แล้ว

      What do I have to do if I want to count how many times a button is pressed?
      Did you realized your solution only works for a single pressing time?

    • @DesertVox
      @DesertVox ปีที่แล้ว

      @@reyhurm Yes, this simple solution is for registering a simple button press. You can add a counter after each delay.

    • @eyehatedog
      @eyehatedog ปีที่แล้ว +1

      delay is bad, it stop the whole code!

  • @ericgrante7043
    @ericgrante7043 ปีที่แล้ว +2

    hello, good video. thanks

  • @JamesFraley
    @JamesFraley ปีที่แล้ว

    Great video! Very informative.

  • @rajibahmed5703
    @rajibahmed5703 6 หลายเดือนก่อน +1

    Very Nice tutorial video.

  • @mikeduino4596
    @mikeduino4596 ปีที่แล้ว +2

    Actually the 7414 output on your timing diagram should be flipped, as the Schmitt trigger is an inverter. Otherwise, it is correct.

  • @1986ah
    @1986ah 4 หลายเดือนก่อน

    I'm working on a project that uses nema42 and stepper driver. It causes EMI interferences and when the motor starts runing, the other inputs on arduino, even not pressed, they changes randomly and completly desurbes the program.
    When i use software debounce with delay function, even at 3ms, it blocs the stepper and vibrating because of the function call evry trigger

  • @GuruprasadGV
    @GuruprasadGV 5 หลายเดือนก่อน

    Why not interrupts

  • @rajibahmed5703
    @rajibahmed5703 6 หลายเดือนก่อน

    We can use the knowledge about delay without blocking programe. I'm talking about millis()