feat: add heart eyes

This commit is contained in:
DinoMalin 2025-03-05 14:22:34 +01:00
parent a3dfc57a73
commit aa3bf4e098
5 changed files with 150 additions and 21 deletions

View File

@ -10,6 +10,8 @@ public:
void drawEyes();
void drawLeftSideEye();
void drawRightSideEye();
void drawAngry();
void drawLove();
void defaultPos();
Face(LCD lcd);
};

View File

@ -38,3 +38,29 @@ void Face::defaultPos() {
this->x = 3;
drawEyes();
}
void Face::drawAngry() {
lcd.clear();
lcd.drawRectangle(x, 0);
lcd.drawChar(x+1, 0, 6);
lcd.drawChar(x+7, 0, 7);
lcd.drawRectangle(x+8, 0);
lcd.drawRectangle(x, 5);
lcd.drawRectangle(x+1, 1);
lcd.drawRectangle(x+7, 1);
lcd.drawRectangle(x+8, 1);
}
void Face::drawLove() {
lcd.clear();
lcd.drawChar(x, 0, 2);
lcd.drawChar(x+1, 0, 3);
lcd.drawChar(x, 1, 4);
lcd.drawChar(x+1, 1, 5);
lcd.drawChar(x+7, 0, 2);
lcd.drawChar(x+8, 0, 3);
lcd.drawChar(x+7, 1, 4);
lcd.drawChar(x+8, 1, 5);
}

12
sketch/characters.h Normal file
View File

@ -0,0 +1,12 @@
#pragma once
extern byte rectangle[8];
extern byte blink[8];
extern byte angryL[8];
extern byte angryR[8];
extern byte Heart1[8];
extern byte Heart2[8];
extern byte Heart3[8];
extern byte Heart4[8];

88
sketch/characters.ino Normal file
View File

@ -0,0 +1,88 @@
#include "characters.h"
byte rectangle[8] = {
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
};
byte blink[8] = {
0,
0,
0,
0,
0,
0b11111,
0b11111,
};
byte angryL[8] = {
0b10000,
0b11000,
0b11100,
0b11110,
0b11111,
0b11111,
0b11111,
0b11111,
};
byte angryR[8] = {
0b00001,
0b00011,
0b00111,
0b01111,
0b11111,
0b11111,
0b11111,
0b11111,
};
byte Heart1[8] = {
0,
0,
0,
0,
0b01100,
0b11110,
0b11111,
0b11111,
};
byte Heart2[8] = {
0,
0,
0,
0,
0b00110,
0b01111,
0b11111,
0b11111,
};
byte Heart3[8] = {
0b01111,
0b00111,
0b00011,
0b00001,
0,
0,
0,
0,
};
byte Heart4[8] = {
0b11110,
0b11100,
0b11000,
0b10000,
0,
0,
0,
0,
};

View File

@ -1,34 +1,23 @@
#include "Face.h"
#include "characters.h"
hd44780_I2Cexp lcd; // auto-detects the I2C address
LCD _lcd(&lcd);
Face face(_lcd);
byte rectangle[8] = {
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
0xff,
};
byte blink[8] = {
0,
0,
0,
0,
0,
0b11111,
0b11111,
};
void setup() {
lcd.begin(16, 2);
lcd.createChar(0, rectangle);
lcd.createChar(1, blink);
lcd.createChar(2, Heart1);
lcd.createChar(3, Heart2);
lcd.createChar(4, Heart3);
lcd.createChar(5, Heart4);
lcd.createChar(6, angryL);
lcd.createChar(7, angryR);
Serial.begin(9600);
}
@ -49,6 +38,18 @@ void loop() {
face.blink();
delay(300);
face.drawEyes();
delay(800);
face.drawAngry();
delay(800);
face.drawEyes();
delay(800);
face.drawLove();
delay(1000);
Serial.print("[CMD]");
Serial.println("[firefox --new-window 'https://www.terre-plate.org/terre-plate-preuve-ultime/']");
Serial.print("[CMD]");