Library and 'hello World' demo program for Seed Groove Ultrasonic distance meter. See also https://github.com/Seeed-Studio/Grove_Ultrasonic_Ranger/blob/master/Ultrasonic.h, http://www.seeedstudio.com/wiki/Grove_-_Ultrasonic_Ranger

Dependencies:   Seed_Ultrasonic_Range mbed

main.cpp

Committer:
grassel
Date:
2014-11-01
Revision:
1:9e37d8d9c360
Parent:
0:8fa7c091d4de

File content as of revision 1:9e37d8d9c360:

#include "mbed.h"
#include "Ultrasonic.h"

Ultrasonic u(p1); // this must be a pin suitable for DigitalInOut
DigitalOut led(LED1);

int main() {
    long dist;
    while(1) {
        dist= u.measureInCentimeters();
        printf("measured distance %d cm\r\n", dist);
        led = !led;
        wait(1.0f);
    }
}