EES Stephen Perse Sixth Form
/
SRF05_HelloWorld
works
Fork of SRF05_HelloWorld by
main.cpp@1:612f5d9de345, 2016-11-29 (annotated)
- Committer:
- darcy11025
- Date:
- Tue Nov 29 15:48:54 2016 +0000
- Revision:
- 1:612f5d9de345
- Parent:
- 0:d87132986e8f
- Child:
- 2:f9045153af1e
code that works
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
simon | 0:d87132986e8f | 1 | // Simple program to read the distance from an SRF05 using the SRF05 library |
simon | 0:d87132986e8f | 2 | |
simon | 0:d87132986e8f | 3 | #include "mbed.h" |
simon | 0:d87132986e8f | 4 | #include "SRF05.h" |
simon | 0:d87132986e8f | 5 | |
darcy11025 | 1:612f5d9de345 | 6 | SRF05 srf(p9, p10); |
simon | 0:d87132986e8f | 7 | |
simon | 0:d87132986e8f | 8 | int main() { |
simon | 0:d87132986e8f | 9 | while(1) { |
darcy11025 | 1:612f5d9de345 | 10 | printf("Distance = %.1f\n\r", srf.read()); |
simon | 0:d87132986e8f | 11 | wait(0.2); |
simon | 0:d87132986e8f | 12 | } |
simon | 0:d87132986e8f | 13 | } |