Duck Hunt LCD Animation

Animation of Duck Hunt using the LCD panel.

 

Video: DUCK HUNT

Code:

#include <SoftwareSerial.h>

SoftwareSerial LCD(6,7); // RX, TX
byte zero = 0; //grass1
byte one = 1;//grass2
byte two = 2;//gun1 (at frame 7 – 15then 18 space4b)
byte three = 3;//gun2 (at frame 16 – 17 space4b
byte four = 4;//dog1a (at 19 frame 7)
byte five = 5;//dog1b (at 19 frame 8)
byte six = 6;//dog2a (at 20 frame 7)
byte seven = 7;//dog2b (at 20 frame 8)

void setup(){
LCD.begin (9600);
LCD.write(0x0C);
delay(5);
LCD.write(0x11);
customCharacter();

}

void loop(){
//LCD.print(“Sup Wizurld!”);
//delay(3000);
//LCD.write(0x0c);
//LCD.print(“Hello World!”);
//delay(3000);
//LCD.write(0x0c);LCD.print(“merhaba World”);
//delay(3000);
//LCD.write(0x0c);
//
//LCD.write(zero);
//delay(3000);
//LCD.write(one);
//delay(3000);
//LCD.write(“hello”);
//delay(3000);

LCD.write(” – _ – “);//Frame – 1 nature
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(one);//6
LCD.write(zero);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(one);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(3250);

LCD.write(“v – _ – “);//Frame – 2 nature bird in
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(one);//6
LCD.write(zero);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(one);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(500);

LCD.write(” ^ – _ – “);//Frame – 3 nature bird
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(one);//6
LCD.write(zero);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(one);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(500);

LCD.write(” v – _ – “);//Frame – 4 nature bird
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(one);//6
LCD.write(zero);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(one);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(500);

LCD.write(” ^- _ – “);//Frame – 5 nature bird
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(one);//6
LCD.write(zero);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(one);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(500);

LCD.write(” v _ – “);//Frame – 6 nature bird
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(one);//6
LCD.write(zero);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(one);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(500);

LCD.write(” -^ _ <> – “);//Frame – 7 nature bird gun in
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(one);//6
LCD.write(zero);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(two);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(500);

LCD.write(” – v _ <> – “);//Frame – 8 nature bird gun
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(one);//6
LCD.write(zero);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(two);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(500);

LCD.write(” – ^ _ <> – “);//Frame – 9 nature bird gun
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(one);//6
LCD.write(zero);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(two);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(500);

LCD.write(” – v_ <> – “);//Frame – 10 nature bird gun
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(one);//6
LCD.write(zero);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(two);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(500);

LCD.write(” – ^ <> – “);//Frame – 11 nature bird gun
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(one);//6
LCD.write(zero);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(two);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(500);

 

LCD.write(” – _v<> – “);//Frame – 13 nature bird gun
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(one);//6
LCD.write(zero);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(two);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(500);

LCD.write(” – _<^> – “);//Frame – 14 nature bird gun
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(one);//6
LCD.write(zero);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(two);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(500);

LCD.write(” – _<>v – “);//Frame – 15 nature bird gun
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(one);//6
LCD.write(zero);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(two);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(500);

LCD.write(” – _<*>v- “);//Frame – 16 nature gun fires
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(one);//6
LCD.write(zero);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(three);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(500);

LCD.write(” – _<‘>v- “);//Frame – 17 nature shot missed
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(one);//6
LCD.write(zero);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(three);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(250);

LCD.write(” – _<> v- “);//Frame – 18 missed
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(one);//6
LCD.write(zero);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(two);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(1000);

LCD.write(” – _<> v- “);//Frame – 19 nature dog begins laugh
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(four);//6
LCD.write(five);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(two);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(200);

LCD.write(” – _<> v- “);//Frame – 20 dog laugh 2
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(six);//6
LCD.write(seven);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(two);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(200);

LCD.write(” – _<> v- “);//Frame – 19 repeat
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(four);//6
LCD.write(five);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(two);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(200);

LCD.write(” – _<> v- “);//Frame – 20 repeat
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(six);//6
LCD.write(seven);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(two);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(200);

LCD.write(” – _<> v- “);//Frame – 19 repeat
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(four);//6
LCD.write(five);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(two);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(200);

LCD.write(” – _<> v- “);//Frame – 20 repeat
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(six);//6
LCD.write(seven);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(two);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(200);

LCD.write(” – _<> v- “);//Frame – 19 repeat
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(four);//6
LCD.write(five);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(two);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(200);

LCD.write(” – _<> v- “);//Frame – 20 repeat
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(six);//6
LCD.write(seven);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(two);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(200);

LCD.write(” – _<> v- “);//Frame – 19 repeat
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(four);//6
LCD.write(five);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(two);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(200);

LCD.write(” – _<> v- “);//Frame – 20 repeat
LCD.write(zero);//1
LCD.write(one);//2
LCD.write(zero);//3
LCD.write(one);//4
LCD.write(zero);//5
LCD.write(six);//6
LCD.write(seven);//7
LCD.write(one);//8
LCD.write(zero);//1b
LCD.write(one);//2b
LCD.write(zero);//3b
LCD.write(two);//4b
LCD.write(zero);//5b
LCD.write(one);//6b
LCD.write(zero);//7b
LCD.write(one);//8b
delay(200);
}
void customCharacter(){
LCD.write(0xF8); //grass 1
LCD.write(B100000);
LCD.write(B100000);
LCD.write(B100000);
LCD.write(B00100);
//count
LCD.write(B00101);
LCD.write(B01011);
LCD.write(B11111);
LCD.write(B11111);

LCD.write(0xF9); //grass 2
LCD.write(B100000);
LCD.write(B100000);
LCD.write(B01000);
LCD.write(B10010);
//count
LCD.write(B10100);
LCD.write(B10101);
LCD.write(B01110);
LCD.write(B11111);

LCD.write(0xFA); //gunA
LCD.write(B100000);
LCD.write(B00010);
LCD.write(B00011);
LCD.write(B00110);
//count
LCD.write(B01100);
LCD.write(B11000);
LCD.write(B10011);
LCD.write(B11111);

LCD.write(0xFB); //gunAshot
LCD.write(B01110);
LCD.write(B11011);
LCD.write(B10100);
LCD.write(B10110);
//count
LCD.write(B01101);
LCD.write(B11001);
LCD.write(B10011);
LCD.write(B11111);

LCD.write(0xFC); //dogAnimUpA
LCD.write(B11001);
LCD.write(B00110);
LCD.write(B01001);
LCD.write(B01010);
//count
LCD.write(B10111);
LCD.write(B01010);
LCD.write(B00100);
LCD.write(B00010);

LCD.write(0xFD); //dogAnimUpB
LCD.write(B10011);
LCD.write(B01100);
LCD.write(B10010);
LCD.write(B01010);
//count
LCD.write(B11101);
LCD.write(B01111);
LCD.write(B01111);
LCD.write(B00110);

LCD.write(0xFE); //dogAnimDownA
LCD.write(B100000);
LCD.write(B10001);
LCD.write(B01100);
LCD.write(B01010);
//count
LCD.write(B01001);
LCD.write(B10010);
LCD.write(B10111);
LCD.write(B01010);

LCD.write(0xFF); //dogAnimDownB
LCD.write(B100000);
LCD.write(B10001);
LCD.write(B00110);
LCD.write(B01010);
//count
LCD.write(B10010);
LCD.write(B01001);
LCD.write(B11111);
LCD.write(B01111);

 

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s