pulseIn() problens

Hi, i am new here and i need a help.

I need to read the pulse of 3 sensors, but whit the command PulseIn() the sensors do not read perfectly letting several pulses escape

What can i do?

void loop(){
 
  leituraProduzidas = pulseIn(sensorProduzidas, FALLING);  
  if (leituraProduzidas != 0){
    contadorProduzidas++;
   }

  leituraRejeitadas = pulseIn(sensorRejeitadas, FALLING);
  if (leituraRejeitadas != 0){
    contadorRejeitadas++;
  }

  leituraBoas = pulseIn(sensorBoas, FALLING);
  if (leituraBoas != 0){
    contadorBoas++;
  }

This is just a part of the code

What are the sensors that you are talking about?

When you say "FALLING" the pulseIn() function will wait for the pin to be HIGH, then wait for the pin to go LOW (FALLING), and then count time until the pin goes HIGH again. If the timeout (default is 1 second) occurs the function returns 0. It is easy to miss a pulse if you spend time looking for other pulses.

If the pulses aren't too frequent you can use interrupts to measure the pulse lengths. This should be ble to catch them all.

If the pulses aren't too frequent you can use interrupts to measure the pulse lengths. This should be ble to catch them all.

Actually, the reason to use interrupts is to catch all the pulses even when they come very quickly.

OP: Are you reading ultrasonic sensors? If so, use the NewPing library which uses interrupts instead of pulseIn().

jbellavance:
What are the sensors that you are talking about?

e18-d50nk

ErickMPSilva:
e18-d50nk

That is USELESS information. Post a link, not some catalog number.

PaulS:
That is USELESS information. Post a link, not some catalog number.

if you search in intenet you will found what type of sensor is, but whatever.
http://www.arduiner.com/en/infrared-obstacle-sensors/577-tunable-350cm-e18d50nk-infrared-obstacle-avoidance-sensor-close-switch-smart-car-3809200622756.html

the description is down below, or that link

http://www.electronicaestudio.com/docs/SHT-015d.pdf

if you search in intenet you will found what type of sensor is

Why should I? YOU have the sensor right there in front of you. YOU have the problem.

Pull-up resistor 10K to 5V output of the yellow line circuit design can then access the microcontroller detection would be more stable, the microcontroller can be detected by external hardware interrupt INT0 INT1 to

Someone's translation skills leave a lot to be desired.

PaulS:
Why should I? YOU have the sensor right there in front of you. YOU have the problem.

Ok, the information is here, if you can help me, i will appreciate.

johnwasser:
If the pulses aren't too frequent you can use interrupts to measure the pulse lengths. This should be ble to catch them all.

I tried that, and it works, thank you