Created
December 17, 2019 08:16
-
-
Save SonnyYan/616b69e9abdd3aaca29eea028fd1b825 to your computer and use it in GitHub Desktop.
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
/* | |
Rainbowduino v3.0 Library examples: | |
Print Shapes on 2D plane (8x8 matrix) | |
*/ | |
#include <Rainbowduino.h> | |
char valueFromProcessing; | |
void setup() | |
{ | |
Rb.init(); | |
Serial.begin(9600); | |
} | |
unsigned char x, y, z; | |
void loop() { | |
while (Serial.available()) { | |
valueFromProcessing = Serial.read(); | |
if (valueFromProcessing == 'D') { | |
Rb.fillRectangle(0, 0, 2, 2, random(0xFFFFFF)); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'd') { | |
Rb.fillRectangle(0, 0, 2, 2, 0x000000); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'C') { | |
Rb.fillRectangle(2, 0, 2, 2, random(0xFFFFFF)); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'c') { | |
Rb.fillRectangle(2, 0, 2, 2, 0x000000); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'B') { | |
Rb.fillRectangle(4, 0, 2, 2, random(0xFFFFFF)); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'b') { | |
Rb.fillRectangle(4, 0, 2, 2, 0x000000); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'A') { | |
Rb.fillRectangle(6, 0, 2, 2, random(0xFFFFFF)); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'a') { | |
Rb.fillRectangle(6, 0, 2, 2, 0x000000); // raw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'H') { | |
Rb.fillRectangle(0, 2, 2, 2, random(0xFFFFFF)); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'h') { | |
Rb.fillRectangle(0, 2, 2, 2, 0x000000); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'G') { | |
Rb.fillRectangle(2, 2, 2, 2, random(0xFFFFFF)); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'g') { | |
Rb.fillRectangle(2, 2, 2, 2, 0x000000); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'F') { | |
Rb.fillRectangle(4, 2, 2, 2, random(0xFFFFFF)); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'f') { | |
Rb.fillRectangle(4, 2, 2, 2, 0x000000); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'E') { | |
Rb.fillRectangle(6, 2, 2, 2, random(0xFFFFFF)); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'e') { | |
Rb.fillRectangle(6, 2, 2, 2, 0x000000); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'L') { | |
Rb.fillRectangle(0, 4, 2, 2, random(0xFFFFFF)); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'l') { | |
Rb.fillRectangle(0, 4, 2, 2, 0x000000); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'K') { | |
Rb.fillRectangle(2, 4, 2, 2, random(0xFFFFFF)); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'k') { | |
Rb.fillRectangle(2, 4, 2, 2, 0x000000); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'J') { | |
Rb.fillRectangle(4, 4, 2, 2, random(0xFFFFFF)); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'j') { | |
Rb.fillRectangle(4, 4, 2, 2, 0x000000); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'I') { | |
Rb.fillRectangle(6, 4, 2, 2, random(0xFFFFFF)); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'i') { | |
Rb.fillRectangle(6, 4, 2, 2, 0x000000); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'P') { | |
Rb.fillRectangle(0, 6, 2, 2, random(0xFFFFFF)); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'p') { | |
Rb.fillRectangle(0, 6, 2, 2, 0x000000); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'O') { | |
Rb.fillRectangle(2, 6, 2, 2, random(0xFFFFFF)); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'o') { | |
Rb.fillRectangle(2, 6, 2, 2, 0x000000); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'N') { | |
Rb.fillRectangle(4, 6, 2, 2, random(0xFFFFFF)); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'n') { | |
Rb.fillRectangle(4, 6, 2, 2, 0x000000); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
if (valueFromProcessing == 'M') { | |
Rb.fillRectangle(6, 6, 2, 2, random(0xFFFFFF)); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
delay(1); | |
} | |
if (valueFromProcessing == 'm') { | |
Rb.fillRectangle(6, 6, 2, 2, 0x000000); // draw a filled rectangle line from (0,0) of length and width 7 pixels | |
} | |
// if { | |
// | |
// delay(1000); | |
// } | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment