Skip to content

Instantly share code, notes, and snippets.

@dagon666
Created May 11, 2014 18:16
Show Gist options
  • Save dagon666/1b80851a0ff1ad10d0c6 to your computer and use it in GitHub Desktop.
Save dagon666/1b80851a0ff1ad10d0c6 to your computer and use it in GitHub Desktop.
simple plasma effect
for (uint16_t i = 0; i < 256; i++) {
sin_table[i] = (cos(i/2)*sin(i))*31 + 32;
}
while(1) {
pcd8544_gotoxy(&lcd, 0, 0);
for (uint8_t x = 0; x<PCD8544_W; x++) {
for (uint8_t y = 0; y<PCD8544_H; ) {
yt = y >> 3;
c = sin_table [ (uint8_t)(i + ((uint8_t)hypot(42 - x, 24 - y) >> 1)) ];
if (common_ditherPoint(c,x,y)) {
buff |= _BV( y - (yt << 3) );
}
if (!(++y & 0x07)) {
pcd8544_putblock(&lcd, x, yt, buff);
buff = 0;
}
}
}
--i;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment