Skip to content

Instantly share code, notes, and snippets.

@Ryanhu1015
Last active May 14, 2017 15:29
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 Ryanhu1015/5756df0c3fca8c8c530b1750361b9f82 to your computer and use it in GitHub Desktop.
Save Ryanhu1015/5756df0c3fca8c8c530b1750361b9f82 to your computer and use it in GitHub Desktop.
slave_0x09
unsigned int number[10][8][9] = {/*...is the number i set up in advance*/};
void loop()
{
byte which_number = Wire.read();// the number
switch (which_number)
{
case 0:// number 0
for (byte x = 0; x < 8; x++)
{
for (byte y = 0; y < 8; y++)
{
PixelRGB *p = Colorduino.GetPixel(x, y);
int recep = number[0][x][y];
if (recep)
{
p->r = 255;
p->g = 0;
p->b = 0;
} else
{
p->r = 0;
p->g = 0;
p->b = 0;
}
}
}
Colorduino.FlipPage();
break;
case 1:// number 1
for (byte x = 0; x < 8; x++)
{
for (byte y = 0; y < 8; y++)
{
PixelRGB *p = Colorduino.GetPixel(x, y);
int recep = number[1][x][y];
if (recep)
{
p->r = 255;
p->g = 0;
p->b = 0;
} else
{
p->r = 0;
p->g = 0;
p->b = 0;
}
}
}
Colorduino.FlipPage();
break;
//there are still number 2-9 below, just skip it
/*
.
.
.
.
*/
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment