Skip to content

Instantly share code, notes, and snippets.

@massimomusante
Created August 14, 2012 16:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save massimomusante/3350859 to your computer and use it in GitHub Desktop.
Save massimomusante/3350859 to your computer and use it in GitHub Desktop.
Pacman demo on arduino and hd44780 lcd display (fragments)
// make some custom characters:
...
byte pac2Def[8] = {
0b00000,
0b01110,
0b10100,
0b11000,
0b11100,
0b01110,
0b00000,
0b00000
};
// 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);
}
}
...
// 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