An example of my SharpIR library in use.

Dependencies:   mbed SHARPIR

main.cpp

Committer:
Tomas
Date:
2012-02-02
Revision:
0:d94848220e71

File content as of revision 0:d94848220e71:

#include "mbed.h"
#include "SHARPIR.h"

SHARPIR Sensor(p10); //the output of the sharpIR sensor is connected to the MBEDs pin 10.
int main() {
    float DistanceCM;
    while (1) { //creates an eternal loop
        DistanceCM=Sensor.cm();
        wait_ms(20); //wait 20 ms between each readout
    }
}