AtomSoft
Well-Known Member
Hey guys im trying to use this Ultrasonic Ping Sensor from parallax but to me the documentation is all wrong.
https://www.electro-tech-online.com/custompdfs/2009/09/28015-PING-v16.pdf
If you look at the below image from the manual you can see tBurst.. Looks like a normal pwm style data coming from the sensor.
But in reality its a single long wave. (solid high)
I have some code to get the numbers but i know it has to be wrong because im never right the first time.
MyPing variable show contain the length of the high pulse ... but how do i convert that to CM? or better yet Inches?
This module supposed to work from 3CM to 3M
https://www.electro-tech-online.com/custompdfs/2009/09/28015-PING-v16.pdf
If you look at the below image from the manual you can see tBurst.. Looks like a normal pwm style data coming from the sensor.
But in reality its a single long wave. (solid high)
I have some code to get the numbers but i know it has to be wrong because im never right the first time.
Code:
void GetPing(void){
unsigned int MyPing = 0;
char Done = 0;
PingDir = 0;
PingOut = 0;
Delay16uS();
PingOut = 1;
Delay10TCY();
PingOut = 0;
PingDir = 1;
PingIn = 0;
while(!PingIn);
while(PingIn){
MyPing++;
}
}
MyPing variable show contain the length of the high pulse ... but how do i convert that to CM? or better yet Inches?
This module supposed to work from 3CM to 3M