Skip to main content

Questions tagged [pulsein]

refers to the function pulseIn().

Filter by
Sorted by
Tagged with
10 votes
4 answers
42k 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(...
shajib0o's user avatar
  • 531
8 votes
2 answers
11k 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 ...
Peter Bloomfield's user avatar
5 votes
2 answers
8k views

Read RC receiver channels using Interrupt instead of PulseIn

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 ...
RLJ's user avatar
  • 53
3 votes
1 answer
496 views

Pulsein() function blocks other tasks from running silmultaneously

I am using a zumo bot with a reflectance sensor used to follow a black line. I want to use an arduino to make the zumo bot stop once it gets a certain distance from an obstacle. I have an ultrasonic ...
Princess Wilson's user avatar
3 votes
2 answers
723 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)...
CjZ's user avatar
  • 39
3 votes
1 answer
9k 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, ...
shurup's user avatar
  • 300
2 votes
2 answers
6k 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?
Mat_python's user avatar
2 votes
1 answer
252 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 ...
kshitiz agarwal's user avatar
2 votes
2 answers
1k 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 ...
Navin Sridhar's user avatar
2 votes
0 answers
142 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 ...
DarkHorse's user avatar
  • 165
1 vote
2 answers
305 views

Working with pulseIn() and millis()

I'm trying to use pulseIn with elapsed time using millis(), I don't want to use interrupts instead of pulseIn (I need pulseIn because I need accurate pulse time), the elapsed time doesn't need to be ...
Takata's user avatar
  • 71
1 vote
1 answer
361 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 ...
j t's user avatar
  • 11
1 vote
1 answer
302 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?
Mat_python's user avatar
1 vote
1 answer
3k 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?
thunderzips's user avatar
1 vote
1 answer
95 views

How execution time of code instructions influences signal between Arduino and DHT11?

I am exemining code for DHT11 from CircuitGeeks, variant without using lib. The problem is a mismatch between DHT11/DHT22 protocol and signals, which are read from sensor in scetch. Despite this, ...
Artur Krush's user avatar
1 vote
2 answers
2k views

PulseIn tachometer

I tried to create a tachometer for my motorcycle using an Arduino Uno. I am trying to measure the voltage of the ignition coil (stepped down to not destroy the Arduino). I am trying to determine the ...
Andrei Grigore's user avatar
1 vote
2 answers
2k 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,...
dariosalvi's user avatar
1 vote
1 answer
156 views

Pulsein not working when share ground

I have 3rd party device that create PWM output which I want to measure it with Arduino, the problem I have is when I shared ground between the two boards which cause the Pulsein output to become zero. ...
Shahreza's user avatar
  • 165
1 vote
2 answers
306 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 ...
user avatar
1 vote
1 answer
349 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 ...
Francesco Valla's user avatar
1 vote
1 answer
1k 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 ...
Petr's user avatar
  • 253
1 vote
2 answers
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() ...
Bilal Ayub's user avatar
1 vote
2 answers
825 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()?
Mohsen Salahshoor's user avatar
1 vote
1 answer
641 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 ...
Ozymandias's user avatar
1 vote
0 answers
152 views

Arduino 33 Nano BLE Sense not compatible with pulseIn()?

Preface Currently, I'm making an application on a Arduino 33 Nano BLE Sense. I'm trying to measure the current humidity and send it via BLE to another device. The target is to send a precise value ...
fuggerjaki61's user avatar
1 vote
0 answers
4k views

pulseIn on ESP32 return 0 regularly

I'm using pulseIn on an ESP32 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 ...
Thiqua's user avatar
  • 11
1 vote
1 answer
276 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 ...
Miguel Sanz Narrillos's user avatar
0 votes
1 answer
299 views

How to trigger a function by detecting voltage change?

#define monitor_pin 14 void setup() { pinMode(monitor_pin , INPUT); } void loop() { unsigned long d1 = pulseIn(14, HIGH); if (d1>0){//trigger function} } I know there is a function ...
Jess's user avatar
  • 53
0 votes
1 answer
666 views

Can an Arduino Uno be used to measure the frequency of a square wave of up to 600 kHz?

I am doing a project with a color sensor, where the output of the color sensor is a PWM square wave. To measure its frequency using an Arduino Uno I am using the pulseIn() function, but I can't get ...
MADHAN KUMAR. S's user avatar
0 votes
2 answers
2k 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 ...
Arda Zaman's user avatar
0 votes
1 answer
22 views

PulseIN not recognised [closed]

I have included the library for the HCSR04 echo sounder, but pulseIN is not recognised; it never goes orange either. I have tried multiple libraries, and closing down the IDE and opening it back up.
Neil's user avatar
  • 1
0 votes
2 answers
680 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 ...
user1245's user avatar
  • 117
0 votes
1 answer
391 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 ...
MortenMoulder's user avatar
0 votes
1 answer
880 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 ...
Ozymandias's user avatar
-1 votes
1 answer
35 views

Interrupt is sporatic, potentially after 220Hz or so

Background although likely not needed: I am recieving a frequency on the destination side of a opto isolater. A fan trips a hall effect sensor, and grounds a circuit which lights the opto. On the ...
Rob Stoner's user avatar