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

Committer:
joran
Date:
Mon Jun 13 09:09:24 2016 +0000
Revision:
15:487e56550364
Parent:
7:8b3aef52aa7b
Added checking for temp sensor connected.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joran 6:067e999b9c6e 1 #include "LCDController.h"
joran 15:487e56550364 2 #include <string>
joran 6:067e999b9c6e 3
joran 6:067e999b9c6e 4 TextLCD lcd(p5, p6, p7, p8, p9, p10, TextLCD::LCD16x2);
joran 6:067e999b9c6e 5
joran 6:067e999b9c6e 6
joran 6:067e999b9c6e 7
joran 6:067e999b9c6e 8 LCDController::LCDController()
joran 6:067e999b9c6e 9 {
joran 6:067e999b9c6e 10 printf("Initiate LCD Controller\n\r");
joran 6:067e999b9c6e 11 lcd.cls();
joran 6:067e999b9c6e 12
joran 6:067e999b9c6e 13 }
joran 6:067e999b9c6e 14
joran 6:067e999b9c6e 15 void LCDController::splash()
joran 6:067e999b9c6e 16 {
joran 6:067e999b9c6e 17 lcd.cls();
joran 6:067e999b9c6e 18 lcd.printf("Welcome to\nSaltware");
joran 6:067e999b9c6e 19 wait(2.0);
joran 6:067e999b9c6e 20 }
joran 6:067e999b9c6e 21
joran 6:067e999b9c6e 22 void LCDController::updateScreen(float displaytemp, float saltvolt)
joran 6:067e999b9c6e 23 {
joran 6:067e999b9c6e 24 lcd.cls();
joran 15:487e56550364 25 char tempbuffer[16];
joran 15:487e56550364 26
joran 15:487e56550364 27 if ( displaytemp > 100)
joran 15:487e56550364 28 {
joran 15:487e56550364 29 snprintf(tempbuffer,sizeof(tempbuffer),"Temp: NC");
joran 15:487e56550364 30 } else {
joran 15:487e56550364 31 snprintf(tempbuffer,sizeof(tempbuffer),"Temp: %.1fC",displaytemp);
joran 15:487e56550364 32 }
joran 15:487e56550364 33
joran 15:487e56550364 34 lcd.printf("%s\nSalt: %.3fPPT",tempbuffer,saltvolt);
joran 6:067e999b9c6e 35 }