Zill Khan
/
ROS_HCSR04_test
Integration of HCSR04 with Nucleo board. ROS Enabled
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 | } |