#include <Wire.h>
#include <hd44780.h> // main hd44780 header
#include <hd44780ioClass/hd44780_I2Cexp.h> // i2c expander i/o class header
const uint8_t nbColonnes = 16;
const uint8_t nbLignes = 2;
hd44780_I2Cexp lcd;
const char lockBitmap[] PROGMEM = {
0b01110,
0b10001,
0b10001,
0b11111,
0b11011,
0b11011,
0b11111,
0b00000
};
const uint8_t lock = 0;
const char unlockBitmap[] PROGMEM = {
0b01110,
0b10000,
0b10000,
0b11111,
0b11011,
0b11011,
0b11111,
0b00000
};
const uint8_t unlock = 1;
const char OKBitmap[] PROGMEM = {
0b00000,
0b00001,
0b00011,
0b10110,
0b11100,
0b01000,
0b00000,
0b00000
};
const uint8_t OK = 2;
const char clocheBitmap[] PROGMEM = {
0b00100,
0b01110,
0b01110,
0b01110,
0b11111,
0b00000,
0b00100,
0b00000
};
const uint8_t cloche = 3;
void setup() {
Serial.begin(115200);
int result = lcd.begin(nbColonnes, nbLignes);
if (result) {
Serial.print("LCD initialization failed: ");
Serial.println(result);
hd44780::fatalError(result);
}
lcd.createChar(lock, lockBitmap);
lcd.createChar(unlock, unlockBitmap);
lcd.createChar(OK, OKBitmap);
lcd.createChar(cloche, clocheBitmap);
char buf[17];
strcpy(buf, "codes : "); // on remplit les index de 0 à 7
buf[8] = (char) lock;
buf[9] = (char) unlock;
buf[10] = (char) OK;
buf[11] = (char) cloche;
lcd.write(buf, 12); // on doit dire exactement combien de caractères prendre en compte
}
void loop() {}