Pages: [1]   Go Down
Author Topic: pulseIn(), photogate, time measurement  (Read 1397 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 (0.16 KB - downloaded 9 times.)
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 211
Posts: 13478
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


you can post code between [ code] (without space) tags by using the #button above the edit field
Code:
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?


Logged

Rob Tillaart

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

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 (51.37 KB, 640x480 - viewed 27 times.)
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Shannon Member
****
Karma: 199
Posts: 11671
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Wherever your Arduino installation lives, look in ../hardware/arduino/core/arduino/wiring_pulse.c
Logged

[ I won't respond to messages, use the forum please ]

Pages: [1]   Go Up
Jump to: