#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
// Пины для подключения Nokia 5110
#define LCD_CLK 3
#define LCD_DIN 4
#define LCD_DC 5
#define LCD_CE 7
#define LCD_RST 6
Adafruit_PCD8544 display = Adafruit_PCD8544(LCD_CLK, LCD_DIN, LCD_DC, LCD_CE, LCD_RST);
// Массив изображений в формате 84x48 пикселей (каждый массив 504 байта)
const unsigned char image1[] PROGMEM = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
// ... (остальные данные изображения)
};
const unsigned char image2[] PROGMEM = {
// Данные второго изображения в том же формате
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
// ... (остальные данные изображения)
};
const unsigned char* images[] = {image1, image2};
const int imageCount = 2;
int currentImage = 0;
unsigned long lastChangeTime = 0;
const unsigned long slideInterval = 2000; // Интервал смены 2 секунды
void setup() {
display.begin();
display.setContrast(50); // Установите контраст 30-60
display.clearDisplay();
display.display();
}
void loop() {
if (millis() - lastChangeTime >= slideInterval) {
showNextImage();
lastChangeTime = millis();
}
}
void showNextImage() {
currentImage = (currentImage + 1) % imageCount;
display.clearDisplay();
display.drawBitmap(0, 0, images[currentImage], 84, 48, BLACK);
display.display();
}Loading
nokia-5110
nokia-5110