pulseIn(), photogate, time measurement

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?

fotogate_SerialPrint.txt (166 Bytes)

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

unsigned long time;
void setup ()
{
  Serial.begin(9600);  
  pinMode(7,INPUT);
}

void loop ()
{
  time = pulseIn(7,LOW);
  if (time > 0)
  {
    Serial.println(time);
  }
}

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

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

here's a pic

2012-03-10-235150.jpg

I'd read some on http://arduino.cc/forum/index.php/topic,74813.0.html, and here: Google Code Archive - Long-term storage for Google Code Project Hosting., 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