Étape 9: RGB LCD (facultatif)
Assembler selon le guide sur le site adafruit...
Ajouter LCD code à code ouvert Save...
#include < Adafruit_MCP23017.h >
#include < Adafruit_RGBLCDShield.h >
#define rouge 0 x 1
#define jaune 0 x 3
#define vert 0 x 2
#define bleu 0 x 6
time_t elapsedTime ;
Sub OnboardDisplay::Update()
{
uint8_t curstate = g_EvseController.GetState() ;
int i ;
Si (g_EvseController.StateTransition()) {}
{Switch(curstate)}
case EVSE_STATE_A: / / non connecté
lcd.setBacklight(GREEN) ;
lcd.setCursor (0, 0) ;
LCD.Print ("Save Ready") ;
lcd.setCursor(13,0) ;
LCD.Print((int)g_EvseController.GetCurrentCapacity()) ;
LCD.Print("A") ;
lcd.setCursor (0, 1) ;
LCD.Print ("non connecté") ;
rupture ;
case EVSE_STATE_B: / / recharge/non connecté
lcd.setBacklight(YELLOW) ;
lcd.setCursor (0, 0) ;
LCD.Print ("Save Ready") ;
lcd.setCursor(13,0) ;
LCD.Print((int)g_EvseController.GetCurrentCapacity()) ;
LCD.Print("A") ;
lcd.setCursor (0, 1) ;
LCD.Print ("Waiting for EV") ;
rupture ;
case EVSE_STATE_C: / / chargement
lcd.setBacklight(BLUE) ;
lcd.setCursor (0, 0) ;
LCD.Print (« recharger ») ;
LCD.Print((int)g_EvseController.GetCurrentCapacity()) ;
LCD.Print ("A") ;
rupture ;
case EVSE_STATE_D: / / évent requis
lcd.setBacklight(RED) ;
lcd.setCursor (0, 0) ;
LCD.Print ("Save Error") ;
lcd.setCursor (0, 1) ;
LCD.Print ("VENT requis ») ;
rupture ;
affaire EVSE_STATE_DIODE_CHK_FAILED :
lcd.setBacklight(RED) ;
lcd.setCursor (0, 0) ;
LCD.Print ("Save Error") ;
lcd.setCursor (0, 1) ;
LCD.Print ("DIODE CHK impossible") ;
rupture ;
affaire EVSE_STATE_GFCI_FAULT :
lcd.setBacklight(RED) ;
lcd.setCursor (0, 0) ;
LCD.Print ("Save Error") ;
lcd.setCursor (0, 1) ;
LCD.Print ("défaillance de disjoncteur différentiel") ;
rupture ;
}
}
Si (curstate == EVSE_STATE_C) {}
lcd.setCursor (0, 1) ;
elapsedTime = now() ;
Si (hour(elapsedTime) < 10) {}
LCD.Print("0") ;
}
LCD.Print(Hour(ElapsedTime)) ;
LCD.Print(":") ;
Si (minute(elapsedTime) < 10) {}
LCD.Print("0") ;
}
LCD.Print(minute(ElapsedTime)) ;
LCD.Print(":") ;
Si (second(elapsedTime) < 10) {}
LCD.Print("0") ;
}
LCD.Print(second(ElapsedTime)) ;
LCD.Print("") ;
}
}