Programa para usar sensor MaxSonar EZ01 con la libreria MaxSonar

Dependencies:   MaxSonar mbed

Committer:
migool
Date:
Thu Mar 27 23:31:23 2014 +0000
Revision:
0:0915212278c6
Revision commit to "senorpulse"

Who changed what in which revision?

UserRevisionLine numberNew contents of line
migool 0:0915212278c6 1 #include "mbed.h"
migool 0:0915212278c6 2 #include "MaxSonar.h"
migool 0:0915212278c6 3 Serial pc(USBTX, USBRX);
migool 0:0915212278c6 4 MaxSonar sensor(PTD4);
migool 0:0915212278c6 5 float in;
migool 0:0915212278c6 6 float cm;
migool 0:0915212278c6 7
migool 0:0915212278c6 8 int main() {
migool 0:0915212278c6 9 while(1) {
migool 0:0915212278c6 10 in=sensor.getinches();
migool 0:0915212278c6 11 cm=sensor.getcm();
migool 0:0915212278c6 12 pc.printf("in: %f, cm: %f", in,cm);
migool 0:0915212278c6 13 wait(2);
migool 0:0915212278c6 14 }
migool 0:0915212278c6 15 }