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@5:44ce56378b65, 2016-06-08 (annotated)
- Committer:
- joran
- Date:
- Wed Jun 08 13:37:18 2016 +0000
- Revision:
- 5:44ce56378b65
- Child:
- 10:fd4670ec0806
- Child:
- 15:487e56550364
Added proximitycontroller
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 | 5:44ce56378b65 | 8 | printf ("Initialize proximity sensor"); |
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 | } |