Programa para usar sensor MaxSonar EZ01 con la libreria MaxSonar

Dependencies:   MaxSonar mbed

main.cpp

Committer:
migool
Date:
2014-03-27
Revision:
0:0915212278c6

File content as of revision 0:0915212278c6:

#include "mbed.h"
#include "MaxSonar.h"
Serial pc(USBTX, USBRX);
MaxSonar sensor(PTD4);
float in;
float cm;

int main() { 
    while(1) {    
    in=sensor.getinches();
    cm=sensor.getcm();
    pc.printf("in: %f, cm: %f", in,cm);
    wait(2);
    }
}