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@16:b9c4fd837909, 2016-06-13 (annotated)
- Committer:
- joran
- Date:
- Mon Jun 13 09:17:50 2016 +0000
- Revision:
- 16:b9c4fd837909
- Parent:
- 10:fd4670ec0806
Added checking 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 | 16:b9c4fd837909 | 24 | |
joran | 16:b9c4fd837909 | 25 | char tempbuffer[16]; |
joran | 16:b9c4fd837909 | 26 | |
joran | 16:b9c4fd837909 | 27 | if (displaytemp > 100) |
joran | 16:b9c4fd837909 | 28 | { |
joran | 16:b9c4fd837909 | 29 | sprintf (tempbuffer, "Temp: NC"); |
joran | 16:b9c4fd837909 | 30 | } else { |
joran | 16:b9c4fd837909 | 31 | sprintf (tempbuffer, "Temp: %.1fC",displaytemp); |
joran | 16:b9c4fd837909 | 32 | } |
joran | 16:b9c4fd837909 | 33 | |
joran | 16:b9c4fd837909 | 34 | |
joran | 16:b9c4fd837909 | 35 | lcd.printf("%s\nSalt: %.3fPPT",tmepbuffer,saltvolt); |
joran | 6:067e999b9c6e | 36 | } |
sbouber1 | 10:fd4670ec0806 | 37 | |
sbouber1 | 10:fd4670ec0806 | 38 | void LCDController::updateScreen(float distance) { |
sbouber1 | 10:fd4670ec0806 | 39 | lcd.cls(); |
sbouber1 | 10:fd4670ec0806 | 40 | lcd.printf("Distance:\n%.3f", distance); |
sbouber1 | 10:fd4670ec0806 | 41 | } |
sbouber1 | 10:fd4670ec0806 | 42 | |
sbouber1 | 10:fd4670ec0806 | 43 | void LCDController::error(const char *msg) { |
sbouber1 | 10:fd4670ec0806 | 44 | lcd.cls(); |
sbouber1 | 10:fd4670ec0806 | 45 | lcd.printf("ERROR:\n%s", msg); |
sbouber1 | 10:fd4670ec0806 | 46 | } |