Skip to content

Instantly share code, notes, and snippets.

@DenisKirinACS
Forked from massimomusante/PacDemo-1.ino
Created May 4, 2017 23:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DenisKirinACS/6368af891903f1f085ca90823e102350 to your computer and use it in GitHub Desktop.
Save DenisKirinACS/6368af891903f1f085ca90823e102350 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