Loading...
Pages: [1]   Go Down
Author Topic: pulseIn()  (Read 502 times)
0 Members and 1 Guest are viewing this topic.
Ignazio Moresco
Guest
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I'm trying to read an accellerometer with the arduino board and I need to go below millis() to get the pulse length. I saw a pulseIn() implementation in wiring but the arduino 002 alpha doesn't implement it. Do I need to install a wiring library? How can I do that? Is there any shortcut to resolve the problem?

Thank you

Ignazio
Logged

Forum Administrator
MMX
Offline Offline
Edison Member
*****
Karma: 37
Posts: 1138
hallo kompis
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hej Iganzio,

we haven't implemented that function yet. However there are a couple of easy roundabouts, I will mention the easiest one that we use with the Memsic2125:

Code:

val = digitalRead(Signal); // Append signal value to val
while(val == LOW) { // Loop until pin reads a high value
 val = digitalRead(Signal);
}

while(val == HIGH) { // Loop until pin reads a high value
 val = digitalRead(Signal);
 timecount = timecount +1;            // Count echo pulse time
}


This code snippet will listen to a HIGH pulse.

Which accelerometer are you using?

/David
Logged

Ignazio Moresco
Guest
 Bigger Bigger  Smaller Smaller  Reset Reset

David,

thanks so much

that works perfectly

ignazio
Logged

Forum Administrator
MMX
Offline Offline
Edison Member
*****
Karma: 37
Posts: 1138
hallo kompis
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

uoops,

I misspelled your name .. I am sorry  :-[

/David
« Last Edit: October 28, 2005, 05:41:09 pm by DojoDave » Logged

Ignazio Moresco
Guest
 Bigger Bigger  Smaller Smaller  Reset Reset

No big deal

The accellerometer is the Memsic 2125

Ignazio
Logged

Pages: [1]   Go Up
Print
 
Jump to: