ping test

Dependencies:   mbed Ping

main.cpp

Committer:
jasonberry
Date:
2021-02-02
Revision:
0:3898412e9440

File content as of revision 0:3898412e9440:

// 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);
    }
}