Program for the water play project for the course Software Testing Practical 2016 given at the VU University
Dependencies: mbed DRV88255 TextLCD Ping mbed-rtos
ProximityController.cpp@15:487e56550364, 2016-06-13 (annotated)
- Committer:
- joran
- Date:
- Mon Jun 13 09:09:24 2016 +0000
- Revision:
- 15:487e56550364
- Parent:
- 5:44ce56378b65
Added checking for temp sensor connected.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joran | 5:44ce56378b65 | 1 | #include "ProximityController.h" |
joran | 5:44ce56378b65 | 2 | |
joran | 5:44ce56378b65 | 3 | Ping pinger(p30); |
joran | 5:44ce56378b65 | 4 | |
joran | 5:44ce56378b65 | 5 | |
joran | 5:44ce56378b65 | 6 | ProximityController::ProximityController() |
joran | 5:44ce56378b65 | 7 | { |
joran | 15:487e56550364 | 8 | printf ("Initialize proximity sensor\r\n"); |
joran | 5:44ce56378b65 | 9 | } |
joran | 5:44ce56378b65 | 10 | |
joran | 5:44ce56378b65 | 11 | int ProximityController::readDistance() |
joran | 5:44ce56378b65 | 12 | { |
joran | 5:44ce56378b65 | 13 | int range; |
joran | 5:44ce56378b65 | 14 | |
joran | 5:44ce56378b65 | 15 | pinger.Send(); |
joran | 5:44ce56378b65 | 16 | wait_ms(30); |
joran | 5:44ce56378b65 | 17 | range = pinger.Read_cm()/ 2; |
joran | 5:44ce56378b65 | 18 | return range; |
joran | 5:44ce56378b65 | 19 | } |