Go Down

Topic: pulseIn(), photogate, time measurement (Read 1 time) previous topic - next topic


I'm making a pulse reader with Arduino, Atmega 328,  Linux, and Photogate.

doing: digitalRead(pin); I get 0 when interrupt photogate, 1 when I don't. %%%% Fotogate works well, without interruptions  %%%%%

doing: pulseIn(); I just can read pulses shorter than 2 s more or less (200000 micros).

Any idea?


you can post code between [ code] (without space) tags by using the #button above the edit field
Code: [Select]

unsigned long time;
void setup ()

void loop ()
  time = pulseIn(7,LOW);
  if (time > 0)

Which version of the IDE are you using ? 1.0 or 0.22 ?
How did you connect the photogate ? Please post schematics?

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)


arduino 0022+dfsg-4ubuntu0.1, the scheme is just pin of data (gate) to pin 7.

here's a pic


I'd read some on http://arduino.cc/forum/index.php/topic,74813.0.html, and here: http://code.google.com/p/arduino/issues/detail?id=675, but I don't know were find pulseIn to repairit. the code shared by Nick Gammon in the first url presents a half solution but have some crazy problems too.


Wherever your Arduino installation lives, look in ../hardware/arduino/core/arduino/wiring_pulse.c
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131