Subject:
|
Frequency counting
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Sun, 30 Mar 1997 05:54:50 GMT
|
Original-From:
|
Joe Martin <[joema@mpx.]IHateSpam[com.au]>
|
Viewed:
|
1539 times
|
| |
| |
I am having trouble getting my frequency counting code to work.The version I am
posting is a sort of test and should print out a frequency integer in Hz after
approximately one second of processing.Instead what it does is print out all
the values of int d;(see code).If anyone doesn't mind helping it would be much
appreciated.
void main()
{int a;
int b;
int c;
int d;
int e;
a=(int)(seconds()*1000.);
while(1)
{b=digital(7);
if (b>c)
{d+=1;}
c=b;
e=(int)(seconds()*1000.);
if (e-a=1000)
{printf("%d",d);}
}}
Thanks very much to Garth Web for teaching me how to cast.
Joe Martin
|
|
1 Message in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|