Arduino - What is a Pulse and How to Use the pulseIn() Function (with example)

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 พ.ค. 2024
  • Everything you need to know about what is a pulse, and how to measure the duration of a pulse with the pulseIn() Arduino function - using an example with a push button.
    👉 Complete Arduino Course for Beginners: 🔥 rbcknd.com/arduino-for-beginners 🔥
    ✅ Click Here for the corresponding Written Tutorial - Arduino pulseIn() function: roboticsbackend.com/arduino-p...
    0:00 Intro
    0:20 What is a pulse and how does pulseIn() work?
    2:43 Circuit with push button to make the pulseIn() test
    3:50 Write the code with pulseIn()
    7:01 Test the program to measure duration of a pulse
    8:07 Best practices with pulseIn()
    10:30 Outro
    👉 Get all my courses here 👉 rbcknd.com/all-courses
    Twitter: / roboticsbackend
    More Free Tutorials: roboticsbackend.com

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

  • @SaintNicholas322
    @SaintNicholas322 2 ปีที่แล้ว

    Good video thanks for making this, very helpful!

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

    Good explanations thank you for teaching 💕

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

    i am trying to compile for Attiny402 device, but Arduino gives error " error compiling for board Attiny41/402/212/202"
    please advise

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

    Awesome knowledge sir..

  • @thedoctor5036
    @thedoctor5036 2 ปีที่แล้ว

    why aren't you up the trend of youtube ?
    you deserve it bro! keep up :D

    • @RoboticsBackEnd
      @RoboticsBackEnd  2 ปีที่แล้ว

      Thanks Doctor! Consider subscribing and liking the video to help me reach higher numbers ;)

  • @Daminski_Elevator
    @Daminski_Elevator 7 หลายเดือนก่อน

    Thanks for video! I try to do PWM switch (ON/OFF) with pulseIn() function like in your video. But there is no reaction. Could you help me to fix this problem?

  • @Europayacht
    @Europayacht 2 ปีที่แล้ว

    Very comprehensive - thank you!

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

    hi would this work if i was to count the pulses that come off a 24 v coin mechanism? My coin mech sends a pulse each time a quarter is deposited?

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

      You'd need to use a relay to convert 24V into 5V so you can plug it into the Arduino.

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

    My results do not match yours - will you please tell me why
    #define buttonPin 2
    void setup ()
    {
    Serial.begin (9600);
    pinMode(buttonPin, INPUT);
    }
    void loop()
    {
    unsigned long duration = pulseIn(buttonPin, HIGH, 10000000);
    Serial.println (duration);
    }
    i pressed the button several times : 2sec ,2 sec, 2sec, 6 sec
    these results were shown on serial monitor
    60
    61
    41
    995942
    64
    0
    42
    0
    0