Last active
May 14, 2017 15:29
-
-
Save Ryanhu1015/5756df0c3fca8c8c530b1750361b9f82 to your computer and use it in GitHub Desktop.
slave_0x09
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
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