Created
April 8, 2018 10:36
-
-
Save dadecoza/d2e6111d5ddf226865b331f6ff3a7beb to your computer and use it in GitHub Desktop.
Animated Horse for Arduino with 16x2 LCD display. There are 3 frames and 8 custom characters per frame.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <LiquidCrystal.h> | |
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // LiquidCrystal Library - Example Pinouts | |
//LiquidCrystal lcd(8, 9, 4, 5, 6, 7); // LCD Keypad Shield Pinouts | |
int x = 0; | |
byte chr[3][8][8] = { | |
{ | |
{0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x0E, 0x0E}, | |
{0x00, 0x00, 0x00, 0x00, 0x0F, 0x1F, 0x1F, 0x1F}, | |
{0x00, 0x00, 0x00, 0x03, 0x07, 0x1F, 0x1F, 0x1F}, | |
{0x00, 0x00, 0x05, 0x1F, 0x1D, 0x1F, 0x16, 0x06}, | |
{0x0C, 0x18, 0x10, 0x00, 0x01, 0x01, 0x01, 0x00}, | |
{0x1F, 0x1F, 0x1E, 0x17, 0x00, 0x00, 0x10, 0x00}, | |
{0x1F, 0x1F, 0x03, 0x02, 0x14, 0x04, 0x02, 0x00}, | |
{0x1C, 0x1C, 0x04, 0x04, 0x08, 0x00, 0x00, 0x00} | |
}, | |
{ | |
{0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0F, 0x1E}, | |
{0x00, 0x00, 0x00, 0x00, 0x0E, 0x1F, 0x1F, 0x1F}, | |
{0x00, 0x00, 0x00, 0x01, 0x07, 0x1F, 0x1F, 0x1F}, | |
{0x00, 0x05, 0x1F, 0x1D, 0x1F, 0x1B, 0x13, 0x10}, | |
{0x13, 0x03, 0x06, 0x0C, 0x10, 0x10, 0x00, 0x00}, | |
{0x1F, 0x17, 0x06, 0x0C, 0x10, 0x10, 0x00, 0x00}, | |
{0x1F, 0x1F, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00}, | |
{0x10, 0x18, 0x1C, 0x08, 0x08, 0x00, 0x10, 0x00} | |
}, | |
{ | |
{0x00, 0x00, 0x00, 0x07, 0x0F, 0x0E, 0x1C, 0x18}, | |
{0x00, 0x00, 0x00, 0x0F, 0x1F, 0x1F, 0x1F, 0x1F}, | |
{0x00, 0x00, 0x01, 0x03, 0x1F, 0x1F, 0x1F, 0x1F}, | |
{0x14, 0x1C, 0x1A, 0x1E, 0x1F, 0x13, 0x10, 0x10}, | |
{0x13, 0x13, 0x02, 0x02, 0x04, 0x00, 0x00, 0x00}, | |
{0x1F, 0x07, 0x0E, 0x06, 0x01, 0x00, 0x00, 0x00}, | |
{0x0F, 0x03, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00}, | |
{0x10, 0x18, 0x0C, 0x02, 0x02, 0x11, 0x00, 0x00} | |
} | |
}; | |
void setup() { | |
lcd.begin(16, 2); | |
} | |
void loop() { | |
if (x > 15) x = -4; | |
for (int f = 0; f < 3; f++) { | |
lcd.clear(); | |
for (int i=0; i<8; i++) { | |
lcd.createChar(i, chr[f][i]); | |
} | |
for (int c = 0; c < 4; c++) { | |
int xc = x+c; | |
if ((xc >= 0)&&(xc < 16)) { | |
lcd.setCursor(x+c, 0); lcd.write(byte(c)); | |
lcd.setCursor(x+c, 1); lcd.write(byte(c+4)); | |
} | |
} | |
x++; | |
delay(400); | |
} | |
} |
Author
dadecoza
commented
Apr 30, 2018
Can u show us the running cheetah
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment