Demo Program for the Parallax X-Band Motion detector.
Dependencies: Parallax_X-Band mbed
Diff: main.cpp
- Revision:
- 0:207fde6d4312
- Child:
- 1:f03e66b92d1d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Mar 08 20:03:06 2015 +0000 @@ -0,0 +1,20 @@ +#include "mbed.h" +#include "Parallax_X-Band.h" + +Serial pc(USBTX, USBRX); + +xband myxband(p26, p25); + +int main() +{ + // Enable the motion detector. + myxband.enable(true); + + while(1) { + // Wait for a new velocity value to be calculated. + while (myxband.velocityack() == true) { + // Once a new one is avaliable print it to the USB serial port. + pc.printf("Velocity: %f Ticks/sec\n\r",myxband.read_velocity()); + } + } +} \ No newline at end of file