LCD RGB

Dependents:   Prg_TP_CAN

Fork of Dashboard by Karim EL GHARBI

Committer:
KEG
Date:
Tue Jun 05 16:22:55 2018 +0000
Revision:
1:666c0aa82871
Parent:
0:a0ef433339ff
Prog Final

Who changed what in which revision?

UserRevisionLine numberNew contents of line
KEG 0:a0ef433339ff 1 #include "mbed.h"
KEG 0:a0ef433339ff 2 #include "Dashboard.h"
KEG 1:666c0aa82871 3 #include <string>
KEG 0:a0ef433339ff 4
KEG 0:a0ef433339ff 5 Dashboard::Dashboard(PinName sda, PinName scl):Grove_LCD_RGB_Backlight(sda,scl)
KEG 0:a0ef433339ff 6 {
KEG 0:a0ef433339ff 7 this->init();
KEG 0:a0ef433339ff 8 };
KEG 0:a0ef433339ff 9
KEG 1:666c0aa82871 10 void Dashboard::printData(signed char *str)
KEG 0:a0ef433339ff 11 {
KEG 1:666c0aa82871 12 char result[32];
KEG 1:666c0aa82871 13 signed char temperature = str[0];
KEG 1:666c0aa82871 14 char hygrometrie = str[3];
KEG 1:666c0aa82871 15 int pression = (str[1]<<8) + str[2];
KEG 1:666c0aa82871 16
KEG 1:666c0aa82871 17 sprintf(result, "T: %d H: %d",temperature,hygrometrie);
KEG 1:666c0aa82871 18 this->locate(0,0);
KEG 0:a0ef433339ff 19 this->print(result);
KEG 1:666c0aa82871 20
KEG 1:666c0aa82871 21 sprintf(result, "P : %d",pression);
KEG 1:666c0aa82871 22 this->locate(0,1);
KEG 1:666c0aa82871 23 this->print(result);
KEG 1:666c0aa82871 24 }
KEG 1:666c0aa82871 25
KEG 1:666c0aa82871 26 void Dashboard::changeColor(signed char temp)
KEG 1:666c0aa82871 27 {
KEG 1:666c0aa82871 28 if(temp<0){
KEG 1:666c0aa82871 29 temp=temp+10;
KEG 1:666c0aa82871 30 }
KEG 1:666c0aa82871 31 this->setRGB(temp,0,40-temp);
KEG 0:a0ef433339ff 32 }
KEG 0:a0ef433339ff 33
KEG 0:a0ef433339ff 34
KEG 0:a0ef433339ff 35