jason berry
/
pingtestdean
ping test
Diff: main.cpp
- Revision:
- 0:3898412e9440
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Feb 02 13:46:38 2021 +0000 @@ -0,0 +1,20 @@ +// Continuously send pings and read the sensor +#include "mbed.h" +#include "Ping.h" + +Ping Pinger(p21); +Serial pc(USBTX, USBRX); // tx, rx + +int main() +{ + int range; + + pc.printf("Hello World ping test!\n"); + while(1) + { + Pinger.Send(); + wait_ms(30); + range = Pinger.Read_cm(); + pc.printf("$%d;",range); + } +} \ No newline at end of file