#include <Adafruit_ILI9341.h>
#include <SPI.h>
#define TFT_CS 10
#define TFT_DC 9
#define TFT_RST 8
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);
// Define the emojis as 8x8 pixel arrays
uint8_t emojis[5][8] = {
{B00011000, B00111100, B01111110, B11011011, B11011011, B01111110, B00111100, B00011000}, // Emoji 1
{B00111100, B01000010, B10100101, B10000001, B10100101, B01000010, B00111100, B00000000}, // Emoji 2
{B00011000, B00111100, B01111110, B11111111, B11111111, B01111110, B00111100, B00011000}, // Emoji 3
{B00111100, B01100110, B11000011, B11111111, B11000011, B01100110, B00111100, B00000000}, // Emoji 4
{B00111100, B01100110, B11011011, B11111111, B11011011, B01100110, B00111100, B00000000} // Emoji 5
};
uint16_t colors[5] = {
ILI9341_RED,
ILI9341_GREEN,
ILI9341_BLUE,
ILI9341_YELLOW,
ILI9341_PURPLE
};
void setup() {
Serial.begin(9600);
tft.begin();
tft.setRotation(3); // Adjust the rotation if needed
}
void loop() {
// Clear the screen
tft.fillScreen(ILI9341_BLACK);
// Display larger emojis moving from right to left at 20 pixels per second
int scrollSpeed = 20;
displayLargeEmojis(scrollSpeed);
delay(50); // Adjust the delay for smooth movement
}
void displayLargeEmojis(int speed) {
int emojiWidth = 8;
int emojiHeight = 8;
int scaleFactor = 6; // Scale factor for making emojis 6 times bigger
int displayWidth = tft.width();
static int position = displayWidth;
for (int i = 0; i < 5; i++) {
// Display each enlarged emoji at a moving position
for (int y = 0; y < emojiHeight; y++) {
for (int x = 0; x < emojiWidth; x++) {
if (emojis[i][y] & (1 << (emojiWidth - x - 1))) {
// Draw pixels for the enlarged emoji
for (int dy = 0; dy < scaleFactor; dy++) {
for (int dx = 0; dx < scaleFactor; dx++) {
tft.drawPixel(x * scaleFactor + position - i * 120 - dx, y * scaleFactor + dy, colors[i]);
}
}
}
}
}
}
position -= speed;
if (position <= -120) {
position = displayWidth;
}
}