Subject:
|
Thanks to Chuck and Max
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Mon, 31 Mar 1997 02:26:48 GMT
|
Original-From:
|
Joe Martin <joema@mpx+antispam+.com.au>
|
Viewed:
|
1495 times
|
| |
| |
Thankyou to Chuck and Max for the help with writing this code for reading square
wave frequencies.If anyone else can use it here it is.Be careful though it
resets the board every few seconds.I think that if this is a problem you could
probably adjust it so that this was not necessary.This code prints out the
frequency values measured on the LCD but if you wanted you could substitute that
property for one which recorded those values as a variable.
int main()
{int a,b,c,d,e;
a=(int)(mseconds());
while(1)
{b=digital(7);
if (b>c)
{d+=1;}
c=b;
e=(int)(mseconds());
if ((e-a)>=5000) /*5000 is just smaller than the time in milliseconds between
reset conditions*/
{d=d/5;
printf("%dHz\n",d);
start_process(main());
break;}
}}
|
|
1 Message in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|