LCD RGB
Fork of Dashboard by
Diff: Dashboard.cpp
- Revision:
- 1:666c0aa82871
- Parent:
- 0:a0ef433339ff
--- a/Dashboard.cpp Tue Jun 05 07:41:18 2018 +0000 +++ b/Dashboard.cpp Tue Jun 05 16:22:55 2018 +0000 @@ -1,17 +1,34 @@ #include "mbed.h" #include "Dashboard.h" +#include <string> Dashboard::Dashboard(PinName sda, PinName scl):Grove_LCD_RGB_Backlight(sda,scl) { - //Grove_LCD_RGB_Backlight(sda,scl); this->init(); }; -void Dashboard::printData(char *str) +void Dashboard::printData(signed char *str) { - char* result; - sprintf(result, "T: %d P: %d H: %d",str[0],(str[1]<<8) + str[2],str[3]); + char result[32]; + signed char temperature = str[0]; + char hygrometrie = str[3]; + int pression = (str[1]<<8) + str[2]; + + sprintf(result, "T: %d H: %d",temperature,hygrometrie); + this->locate(0,0); this->print(result); + + sprintf(result, "P : %d",pression); + this->locate(0,1); + this->print(result); +} + +void Dashboard::changeColor(signed char temp) +{ + if(temp<0){ + temp=temp+10; + } + this->setRGB(temp,0,40-temp); }