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
Diff: main.cpp
- Revision:
- 0:8fa7c091d4de
- Child:
- 1:9e37d8d9c360
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Nov 01 20:47:28 2014 +0000 @@ -0,0 +1,16 @@ +#include "mbed.h" +#include "Ultrasonic.h" + +Ultrasonic u(p1); + +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); + } +}