Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@0:d94848220e71, 2012-02-02 (annotated)
- Committer:
- Tomas
- Date:
- Thu Feb 02 11:01:07 2012 +0000
- Revision:
- 0:d94848220e71
- Child:
- 1:ca82df4237eb
SharpIR example
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Tomas | 0:d94848220e71 | 1 | #include "mbed.h" |
Tomas | 0:d94848220e71 | 2 | #include "SHARPIR.h" |
Tomas | 0:d94848220e71 | 3 | |
Tomas | 0:d94848220e71 | 4 | SHARPIR Sensor(p10); //the output of the sharpIR sensor is connected to the MBEDs pin 10. |
Tomas | 0:d94848220e71 | 5 | int main() { |
Tomas | 0:d94848220e71 | 6 | float DistanceCM; |
Tomas | 0:d94848220e71 | 7 | while (1) { //creates an eternal loop |
Tomas | 0:d94848220e71 | 8 | DistanceCM=Sensor.cm(); |
Tomas | 0:d94848220e71 | 9 | wait_ms(20); //wait 20 ms between each readout |
Tomas | 0:d94848220e71 | 10 | } |
Tomas | 0:d94848220e71 | 11 | } |