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
Good video thanks for making this, very helpful!
Good explanations thank you for teaching 💕
i am trying to compile for Attiny402 device, but Arduino gives error " error compiling for board Attiny41/402/212/202"
please advise
Awesome knowledge sir..
why aren't you up the trend of youtube ?
you deserve it bro! keep up :D
Thanks Doctor! Consider subscribing and liking the video to help me reach higher numbers ;)
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?
Very comprehensive - thank you!
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?
You'd need to use a relay to convert 24V into 5V so you can plug it into the Arduino.
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