Demo Program for the Parallax X-Band Motion detector.

Dependencies:   Parallax_X-Band mbed

main.cpp

Committer:
ottaviano3
Date:
2015-03-09
Revision:
1:f03e66b92d1d
Parent:
0:207fde6d4312

File content as of revision 1:f03e66b92d1d:

#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);
    
    // Variable to store read velocity.
    float velocity;

    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.
            velocity = myxband;
            pc.printf("Velocity: %f Ticks/sec\n\r",velocity);
        }
    }
}