# Questions tagged [pulsein]

refers to the function pulseIn().

29 questions
Filter by
Sorted by
Tagged with
9k views

### How precise is the timing of pulseIn()?

I've been using the pulseIn() function for processing PWM-based binary data encoding. It works well for distinguishing pulses which are significantly different lengths, e.g. 500us vs. 1500us. That ...
32k views

### What is the work of pulseIn?

I have code for an ultrasonic sensor which I found from a site. Here is the code: #define trigPin 12 #define echoPin 13 void setup() { Serial.begin (9600); pinMode(trigPin, OUTPUT); pinMode(...
5k views

I am designing my own quadcopter control algorithm, whereby I currently read 4 RC receiver channels using PulseIn on each loop in the following manner: ch1_raw = pulseIn(rcPin1, HIGH, 25000); In ...
439 views

### how to solve Varing duty cycle value while using Pulsein()

Well im new to coding, but i do have the basic knowledge. I'm using an UNO to measure a duty cycle. The source of pulse is a Tektronic signal generator (Duty cycle set to 50.000 with frequency of 2khz)...
4k views

### How can I replace pulseIn with interrupts?

I have an HC-SR04 sensor and I need to get the distance from it. I use this code: digitalWrite(trig, LOW); delayMicroseconds(2); digitalWrite(trig, HIGH); delayMicroseconds(10); digitalWrite(trig, ...
76 views

### Ultrasonic sensor confusion

Here is a code snipet for ultrasonic sensor digitalWrite(trigpin,HIGH); delayMicroseconds(10); digitalWrite(trigpin,LOW); duration=pulseIn(echopin,HIGH); Assume trigpin and echopin pins are already ...
871 views

### Measurement of pulse duration greater than 3mins

Is it possible to measure the width of a pulse which is longer than 3 minutes? The pulseIn function can only measure duration of maximum 3 minutes accurately. I've tried using interrupts but haven't ...
260 views

### When does the pulsein() function start counting?

I have an Arduino Pro mini 3.3V, 8 mHz and I want to use the pulsein() function for a low-going pulse. My question: Does the timer start when the function senses a LOW on the input pin, or when the ...
237 views

### How do I use two PulseIn() functions simultaneously in Arduino?

I want to connect multiple Ultrasonic sensors to my Arduino board. For that, I need multiple pulseIn() functions to work at the same time. How can I do that?
2k views

### What is pulseIn in programming Arduino?

I have seen some tutorials on ultrasonic range detector sensor. In that, what is the meaning of the word pulseIn?
984 views

### read AM signal only with an Arduino

Some people have managed to send simple AM signals with just a bare Arduino. An example is here. This works thanks to the fact that the PWM can reach high frequencies and, setting the divider properly,...
3k views

### How do I use two PulseIn() functions simultaneously in Arduino?

I want to connect multiple Ultrasonic sensors to my Arduino board. For that, I need multiple pulseIn() functions to work at the same time. How can I do that?
282 views

### Speedometer slow reaction arduino

I'm trying to make a speedometer, with utilization of interrupt for get number of pulse and some calculation for getting speed, but when compute speed the arduino freeze for some second and i lose ...
829 views

### Measuring LPO (Low-Pulse Occupancy)

I'm using an Arduino clone (Seeeduino Lotus) together with a Shinyei PPD42NS sensor to measure air quality. The sensor reports its measurement as Low-Pulse occupancy. What would be the best way how to ...
3k views

### How to read RC receiver channels without using pulsein() command with arduino

I am building a quad-copter, the problem is of stability and for better stability lesser sampling time is required. For lesser sampling time I need to have faster loop() function. But the Pulsein() ...
568 views

### Is it correct to use pulseIn() in ISRs?

Since it is not right to use millis() in an ISR to calculate duration of the input, Is it correct to use pulseIn()?
413 views

### Is it possible to use FrSky D8R-II Plus 8ch 2.4Ghz ACCST Receiver with an arduino Uno?

I'm in the process of buying a receiver and transmitter for my quad copter project. Would it be possible to use this receiver or a similar one to control the quad. I'm trying to read the signals using ...
131 views

### Changing parameters of pulseIn() to sense different materials

I have a ultrasonic sensor and in order to get the distance I use the pulseIn() function included in the arduino library, and then change it to distance. As the ultrasounds does not work equally in ...
120 views

### Arduino Record pulseIn

I am currently working on a project which requires me to record IR signals. (I realize there is a library available for doing this but I want to learn how to do this myself). I tried using a simple ...
583 views

### How to measure ultrasonic sensor without pulsein method?

I am a front-end developer so I don't really know Arduino. Anyway, my teacher gave me a project. In short, I have to measure distance with HC-SR04. But the problem is that the teacher wants me to ...
61 views

### Reading consecutive two pulse periods continuously

I'm controlling the DC motor/fan speed by PWM through varying analog input. Using Uno or Nano. The loop is as follows: void loop() { val = analogRead(analogPin0); // read the analog input pin ...
187 views

### mega2560- Interrupts reading digital input

Hi I am very new to Arduino, with very little programming experience. I am using mega 2560 and trying to understand how interrupt works. I have a code written, it is very similar as the example ...
159 views

### How to pulse a signal at 100ms to 500ms?

Based on this PDF I need to pulse between 100ms and 500ms to record a video (the description is apparently wrong according to this guy). How would I generate such a pulse? The small module has 3 wires ...
650 views

### Is PulseIn fast enough for Quadcopter?

I've been trying to use interrupts to control a quadrotor with a tx/rx to no success. I'm using an arduino mega as my control board. I have successfully read a singe channel using attach interrupt and ...
29 views

### Getting Heart Rate (BPM) from pulse sensor Arduino

I am new to arduino and trying to display the heart rate (BPM) using Pulse sensor. I have found a code from internet that calculates the heart rate: #include <Wire.h> #include <LiquidCrystal....
19 views

### pulseIn on ESP32 return 0 regularly

I'm using pulseIn on an ESP23 for measuring a frequency between 500 Hz and 10 KHz. I measure both the HIGH and the LOW time, as all simple examples suggest. 95% of the time the result is correct, but ...
46 views

### Power Factor Measurement

I'm developing a system to measure the power factor between two waves and using a XOR to get the time between them. The programming and the circuit seems fine but some times I get the power factor as ...