Files
Arduino/D1 mini/logo azylis + Sonde.ino

109 lines
4.1 KiB
C++

/**************************************************************************
Auteur : Christophe JEANNEROT
- Gestion d'un ecran LCD de 0.9 Pouces
- Relevé d'une sonde DHT
**************************************************************************/
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// définition de la taille de l'ecran
#define SCREEN_WIDTH 128 // Largeur
#define SCREEN_HEIGHT 64 // Hauteur
#define OLED_RESET -1 // Pas de PIN de reset sur l'écran
#define SCREEN_ADDRESS 0x3C // Adresse de l'ecran
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
// LOGO AZYLIS
#define LOGO_HEIGHT 45
#define LOGO_WIDTH 64
static const unsigned char PROGMEM logo_bmp[] =
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x8F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0xFE, 0x00, 0x00, 0x00, 0x7F,
0xFF, 0xFE, 0x03, 0xFE, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0xFE, 0x03, 0xFE, 0x00, 0x00, 0x00, 0xFF,
0xFF, 0xFC, 0x01, 0xFE, 0x00, 0x00, 0x01, 0xFF, 0xFF, 0xFC, 0x01, 0xFE, 0x00, 0x00, 0x03, 0xFF,
0xFF, 0xF8, 0x00, 0xFF, 0xFF, 0xF0, 0x07, 0xFF, 0xFF, 0xF8, 0x00, 0xFF, 0xFF, 0xE0, 0x0F, 0xFF,
0xFF, 0xF0, 0x00, 0x7F, 0xFF, 0xC0, 0x1F, 0xFF, 0xFF, 0x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x00, 0x1F,
0xF8, 0x1F, 0x83, 0x00, 0x43, 0xF8, 0xC3, 0xFF, 0xF0, 0x0F, 0x83, 0x00, 0xC3, 0xF8, 0xC0, 0x1F,
0xF0, 0x0F, 0x07, 0x80, 0xC3, 0xF8, 0xC0, 0x0F, 0xE0, 0x0E, 0x0F, 0x81, 0xC3, 0xF8, 0xE0, 0x0F,
0xE0, 0x04, 0x1F, 0xC1, 0xC3, 0xF8, 0xFF, 0x0F, 0xE0, 0x04, 0x01, 0xC3, 0xC0, 0x00, 0x00, 0x0F,
0xC3, 0x80, 0x01, 0xC3, 0xC0, 0x00, 0x00, 0x0F, 0xC3, 0xC0, 0x01, 0xC3, 0xC0, 0x00, 0x00, 0x1F,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
void setup() {
Serial.begin(9600);
// Reset de l'écran
display.clearDisplay();
// Affichage du Logo sur l'écran
AffichageLogo();
// Effet Flash du LOGO
display.invertDisplay(true);
delay(1000);
display.invertDisplay(false);
delay(1000);
// Affichage
Affichage();
}
void loop() {
}
void Affichage(void) {
display.clearDisplay();
display.setTextSize(2); // Draw 2X-scale text
display.setTextColor(SSD1306_WHITE);
display.setCursor(0,0);
display.println(F(" MA MAISON")); //display.println(0xDEADBEEF, HEX);
display.setTextSize(1); // Normal 1:1 pixel scale
display.println(F(""));
display.setTextColor(SSD1306_WHITE); // Draw white text
display.println(F("Temparature : 18.0"));
display.println(F(""));
display.println(F(""));
display.setTextColor(SSD1306_BLACK, SSD1306_WHITE); // Draw 'inverse' text
display.println(F(" "));
display.println(F(" TROP Froid !!!! "));
display.display();
//delay(10000);
}
void AffichageLogo(void) {
display.clearDisplay();
display.drawBitmap(
(display.width() - LOGO_WIDTH ) / 2,
(display.height() - LOGO_HEIGHT) / 2,
logo_bmp, LOGO_WIDTH, LOGO_HEIGHT, 1);
display.display();
delay(1000);
}