Created
August 14, 2012 16:59
-
-
Save massimomusante/3350859 to your computer and use it in GitHub Desktop.
Pacman demo on arduino and hd44780 lcd display (fragments)
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
// make some custom characters: | |
... | |
byte pac2Def[8] = { | |
0b00000, | |
0b01110, | |
0b10100, | |
0b11000, | |
0b11100, | |
0b01110, | |
0b00000, | |
0b00000 | |
}; | |
… |
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
… | |
// Initial display fill | |
void fill() | |
{ | |
lcd.setCursor(0,0); | |
lcd.write(pac1); | |
for(int j=0;j<7;j++) | |
{ | |
lcd.write(" "); | |
lcd.write(pill); | |
} | |
lcd.setCursor(0,1); | |
lcd.write(pill); | |
for(int j=0;j<7;j++) | |
{ | |
lcd.write(" "); | |
lcd.write(pill); | |
} | |
} | |
… |
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
... | |
// character animation | |
void anim() | |
{ | |
lcd.setCursor(px,py); | |
lcd.write(" "); | |
lcd.setCursor(x,y); | |
lcd.write(pac1); | |
delay(del); | |
lcd.setCursor(x,y); | |
lcd.write(pac2); | |
delay(del); | |
px = x; | |
py = y; | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment