Original Code Repo: https://os.mbed.com/users/priyank12p/code/Electronically-Connected-Intelligent-She/ Modified for Fall 2021 students.
Dependencies: mbed mbed-http ESP8266
main.cpp@8:25138f7b9309, 2017-01-13 (annotated)
- Committer:
- andcor02
- Date:
- Fri Jan 13 14:48:25 2017 +0000
- Revision:
- 8:25138f7b9309
- Child:
- 9:607ee6e92552
K64F
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
andcor02 | 8:25138f7b9309 | 1 | #include "mbed.h" |
andcor02 | 8:25138f7b9309 | 2 | #include "hcsr04.h" |
andcor02 | 8:25138f7b9309 | 3 | |
andcor02 | 8:25138f7b9309 | 4 | |
andcor02 | 8:25138f7b9309 | 5 | DigitalOut myled(LED1); |
andcor02 | 8:25138f7b9309 | 6 | HCSR04 usensor(D8,D9); |
andcor02 | 8:25138f7b9309 | 7 | unsigned int dist; |
andcor02 | 8:25138f7b9309 | 8 | int main() |
andcor02 | 8:25138f7b9309 | 9 | { |
andcor02 | 8:25138f7b9309 | 10 | |
andcor02 | 8:25138f7b9309 | 11 | while(1) { |
andcor02 | 8:25138f7b9309 | 12 | usensor.start(); |
andcor02 | 8:25138f7b9309 | 13 | wait_ms(500); |
andcor02 | 8:25138f7b9309 | 14 | dist=usensor.get_dist_cm(); |
andcor02 | 8:25138f7b9309 | 15 | printf("\n\r cm:%ld",dist ); |
andcor02 | 8:25138f7b9309 | 16 | |
andcor02 | 8:25138f7b9309 | 17 | } |
andcor02 | 8:25138f7b9309 | 18 | } |