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
LCDController.cpp@17:17ea1372f64a, 2016-06-13 (annotated)
- Committer:
- joran
- Date:
- Mon Jun 13 09:49:37 2016 +0000
- Revision:
- 17:17ea1372f64a
- Parent:
- 10:fd4670ec0806
- Child:
- 18:da84737ee427
Check if temp sensor is connected
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joran | 6:067e999b9c6e | 1 | #include "LCDController.h" |
joran | 6:067e999b9c6e | 2 | |
joran | 6:067e999b9c6e | 3 | TextLCD lcd(p5, p6, p7, p8, p9, p10, TextLCD::LCD16x2); |
joran | 6:067e999b9c6e | 4 | |
joran | 6:067e999b9c6e | 5 | |
joran | 6:067e999b9c6e | 6 | |
joran | 6:067e999b9c6e | 7 | LCDController::LCDController() |
joran | 6:067e999b9c6e | 8 | { |
joran | 6:067e999b9c6e | 9 | printf("Initiate LCD Controller\n\r"); |
joran | 6:067e999b9c6e | 10 | lcd.cls(); |
joran | 6:067e999b9c6e | 11 | |
joran | 6:067e999b9c6e | 12 | } |
joran | 6:067e999b9c6e | 13 | |
joran | 6:067e999b9c6e | 14 | void LCDController::splash() |
joran | 6:067e999b9c6e | 15 | { |
joran | 6:067e999b9c6e | 16 | lcd.cls(); |
joran | 6:067e999b9c6e | 17 | lcd.printf("Welcome to\nSaltware"); |
joran | 6:067e999b9c6e | 18 | wait(2.0); |
joran | 6:067e999b9c6e | 19 | } |
joran | 6:067e999b9c6e | 20 | |
joran | 6:067e999b9c6e | 21 | void LCDController::updateScreen(float displaytemp, float saltvolt) |
joran | 6:067e999b9c6e | 22 | { |
joran | 6:067e999b9c6e | 23 | lcd.cls(); |
joran | 17:17ea1372f64a | 24 | |
joran | 17:17ea1372f64a | 25 | char tempbuffer[16]; |
joran | 17:17ea1372f64a | 26 | |
joran | 17:17ea1372f64a | 27 | if (displaytemp > 100) |
joran | 17:17ea1372f64a | 28 | { |
joran | 17:17ea1372f64a | 29 | sprintf(tempbuffer, "Temp: NC"); |
joran | 17:17ea1372f64a | 30 | } else { |
joran | 17:17ea1372f64a | 31 | sprintf(tempbuffer,"Temp: %.1fC",displaytemp); |
joran | 17:17ea1372f64a | 32 | } |
joran | 17:17ea1372f64a | 33 | |
joran | 17:17ea1372f64a | 34 | |
joran | 17:17ea1372f64a | 35 | |
joran | 17:17ea1372f64a | 36 | lcd.printf("%s\nSalt: %.3fPPT",tempbuffer,saltvolt); |
joran | 6:067e999b9c6e | 37 | } |
sbouber1 | 10:fd4670ec0806 | 38 | |
sbouber1 | 10:fd4670ec0806 | 39 | void LCDController::updateScreen(float distance) { |
sbouber1 | 10:fd4670ec0806 | 40 | lcd.cls(); |
sbouber1 | 10:fd4670ec0806 | 41 | lcd.printf("Distance:\n%.3f", distance); |
sbouber1 | 10:fd4670ec0806 | 42 | } |
sbouber1 | 10:fd4670ec0806 | 43 | |
sbouber1 | 10:fd4670ec0806 | 44 | void LCDController::error(const char *msg) { |
sbouber1 | 10:fd4670ec0806 | 45 | lcd.cls(); |
sbouber1 | 10:fd4670ec0806 | 46 | lcd.printf("ERROR:\n%s", msg); |
sbouber1 | 10:fd4670ec0806 | 47 | } |