mirror of
https://github.com/alopexc0de/pixopixel.git
synced 2024-11-14 23:27:25 +00:00
196 lines
12 KiB
C++
196 lines
12 KiB
C++
/*
|
|
PIXO Pixel WIP Test Program
|
|
This program is a work in progress but will let you test your LED matrix if it is working or not.
|
|
Try out the various Demos and images in the image.h file.
|
|
|
|
Many libraries from Adafruit are needed and can be seen below.
|
|
|
|
*/
|
|
|
|
#include <SPI.h>
|
|
#include <Adafruit_GFX.h>
|
|
#include <Adafruit_DotStarMatrix.h>
|
|
#include <Adafruit_DotStar.h>
|
|
#include <Fonts/FreeMonoOblique9pt7b.h>
|
|
#include "image.h"
|
|
|
|
|
|
|
|
|
|
#define DATAPIN 19
|
|
#define CLOCKPIN 18
|
|
|
|
char *names[] = {"Unexpected Maker",
|
|
"Jon Peer (Rhymes with Beer)",
|
|
"Ran-Dee Glenn",
|
|
"Stee-ven Lud-gate a.k.a. chunky steve-oh",
|
|
"Christian Will-helm",
|
|
"Dale Cousins",
|
|
"Roland Alvares",
|
|
"Abdul Aziz is my best friend",
|
|
"Richard Stewart",
|
|
"Stee-fen Goo-juh",
|
|
"Alexandru Stan",
|
|
"Brad Pow-urrs. I mean, pretty straightforward.",
|
|
"Code Fox",
|
|
"Bobby CC Wong",
|
|
"Tim Bye-Num",
|
|
"nic gill",
|
|
"Jonathan BET-zold",
|
|
"Stay-fan",
|
|
"Nicolai Schwarz ",
|
|
"Bligh-th Gar-rat",
|
|
"Mark S",
|
|
"York",
|
|
"Ernesto Cibrian",
|
|
"Dave Platts",
|
|
"Dj Walker-Morgan",
|
|
"João Miranda",
|
|
"Ther mound (shouldn't be too tough :) )",
|
|
"Reverend Alexander J Bor sick",
|
|
"APSoft (Hey Pea Soft)",
|
|
"Patrick Hah-ga-mahn",
|
|
"Can you say: “YouTube.com/Dubwise” pronounced “Dub-wise”.",
|
|
"Fabian Christ",
|
|
"Steve Berry-man",
|
|
"I feel like it's a pretty self explanatory name haha!",
|
|
"Noah Westwind",
|
|
"MUR-ID-EE-N WIT",
|
|
"Troy Holten",
|
|
"Grant Patterson",
|
|
"Ta-tee Wall-er",
|
|
"Ryan Burrow",
|
|
"ay-vert klei-ink",
|
|
"leee-no veee-hen",
|
|
"Andrew Kind rhymes with mind",
|
|
"Edward Wowl-man",
|
|
"Simon Cleveland",
|
|
"Andrea Scolari",
|
|
"Daril Mac larin",
|
|
"Patrick Füglistaller",
|
|
"Alexandre Tron ( Like the movie , but in french :D GL ! )",
|
|
"Lucky 13",
|
|
"Dan-yul Hoff-my-stir}"
|
|
};
|
|
|
|
|
|
|
|
int mario[256][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {216, 0, 0}, {216, 0, 0}, {216, 0, 0}, {216, 0, 0}, {216, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {216, 0, 0}, {216, 0, 0}, {216, 0, 0}, {216, 0, 0}, {216, 0, 0}, {216, 0, 0}, {216, 0, 0}, {216, 0, 0}, {216, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {112, 104, 0}, {112, 104, 0}, {112, 104, 0}, {248, 171, 0}, {248, 171, 0}, {112, 104, 0}, {248, 171, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {112, 104, 0}, {248, 171, 0}, {112, 104, 0}, {248, 171, 0}, {248, 171, 0}, {248, 171, 0}, {112, 104, 0}, {248, 171, 0}, {248, 171, 0}, {248, 171, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {112, 104, 0}, {248, 171, 0}, {112, 104, 0}, {112, 104, 0}, {248, 171, 0}, {248, 171, 0}, {248, 171, 0}, {112, 104, 0}, {248, 171, 0}, {248, 171, 0}, {248, 171, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {112, 104, 0}, {112, 104, 0}, {248, 171, 0}, {248, 171, 0}, {248, 171, 0}, {248, 171, 0}, {112, 104, 0}, {112, 104, 0}, {112, 104, 0}, {112, 104, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {248, 171, 0}, {248, 171, 0}, {248, 171, 0}, {248, 171, 0}, {248, 171, 0}, {248, 171, 0}, {248, 171, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {112, 104, 0}, {112, 104, 0}, {216, 0, 0}, {112, 104, 0}, {112, 104, 0}, {216, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {112, 104, 0}, {112, 104, 0}, {112, 104, 0}, {216, 0, 0}, {112, 104, 0}, {112, 104, 0}, {216, 0, 0}, {112, 104, 0}, {112, 104, 0}, {112, 104, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {112, 104, 0}, {112, 104, 0}, {112, 104, 0}, {112, 104, 0}, {216, 0, 0}, {216, 0, 0}, {216, 0, 0}, {216, 0, 0}, {112, 104, 0}, {112, 104, 0}, {112, 104, 0}, {112, 104, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {248, 171, 0}, {248, 171, 0}, {112, 104, 0}, {216, 0, 0}, {248, 171, 0}, {216, 0, 0}, {216, 0, 0}, {248, 171, 0}, {216, 0, 0}, {112, 104, 0}, {248, 171, 0}, {248, 171, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {248, 171, 0}, {248, 171, 0}, {248, 171, 0}, {216, 0, 0}, {216, 0, 0}, {216, 0, 0}, {216, 0, 0}, {216, 0, 0}, {216, 0, 0}, {248, 171, 0}, {248, 171, 0}, {248, 171, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {248, 171, 0}, {248, 171, 0}, {216, 0, 0}, {216, 0, 0}, {216, 0, 0}, {216, 0, 0}, {216, 0, 0}, {216, 0, 0}, {216, 0, 0}, {216, 0, 0}, {248, 171, 0}, {248, 171, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {216, 0, 0}, {216, 0, 0}, {216, 0, 0}, {0, 0, 0}, {0, 0, 0}, {216, 0, 0}, {216, 0, 0}, {216, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {112, 104, 0}, {112, 104, 0}, {112, 104, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {112, 104, 0}, {112, 104, 0}, {112, 104, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {112, 104, 0}, {112, 104, 0}, {112, 104, 0}, {112, 104, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {112, 104, 0}, {112, 104, 0}, {112, 104, 0}, {112, 104, 0}, {0, 0, 0}, {0, 0, 0}};
|
|
int patreon[256][3] = {{5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {249, 0, 0}, {249, 0, 0}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {255, 255, 255}, {255, 255, 255}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {249, 0 , 0}, {249, 0 , 0}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {249, 0 , 0}, {249, 0 , 0}, {5, 10, 150}, {5, 10, 150}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {249, 0 , 0}, {249, 0 , 0}, {5, 10, 150}, {5, 10, 150}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {249, 0 , 0}, {249, 0 , 0}, {5, 10, 150}, {94, 120, 138}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {249, 0 , 0}, {249, 0 , 0}, {5, 10, 150}, {5, 10, 150}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {249, 0 , 0}, {249, 0 , 0}, {5, 10, 150}, {5, 10, 150}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {249, 0 , 0}, {249, 0 , 0}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {249, 0 , 0}, {249, 0 , 0}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {255, 255, 255}, {255, 255, 255}, {255, 255, 255}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {249, 0 , 0}, {249, 0 , 0}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {249, 0 , 0}, {249, 0 , 0}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {249, 0 , 0}, {249, 0 , 0}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}, {5, 10, 150}};
|
|
|
|
#define BRIGHTNESS 150
|
|
|
|
// MATRIX DECLARATION:
|
|
Adafruit_DotStarMatrix pixo = Adafruit_DotStarMatrix(
|
|
16, 16, DATAPIN, CLOCKPIN,
|
|
DS_MATRIX_TOP + DS_MATRIX_LEFT +
|
|
DS_MATRIX_ROWS + DS_MATRIX_PROGRESSIVE,
|
|
DOTSTAR_BGR);
|
|
|
|
const uint16_t colors[] = {
|
|
pixo.Color(100, 100, 100), pixo.Color(0, 100, 0), pixo.Color(0, 0, 100)
|
|
};
|
|
|
|
int x = pixo.width();
|
|
int pass = 0;
|
|
int y = 0;
|
|
int numChars = 0;
|
|
void setup() {
|
|
Serial.begin(115200);
|
|
|
|
// uncomment to have wait
|
|
//while (!Serial) delay(500);
|
|
|
|
pixo.begin();
|
|
pixo.setTextWrap(false);
|
|
pixo.setBrightness(BRIGHTNESS);
|
|
pixo.setFont(&FreeMonoOblique9pt7b);
|
|
|
|
pixo.setTextColor(colors[pass]);
|
|
Serial.println(names[y]);
|
|
numChars = numChar(names[y]);
|
|
Serial.println(numChars);
|
|
//while(!Serial);
|
|
}
|
|
|
|
|
|
|
|
void loop() {
|
|
|
|
if (Serial.available() > 0) {
|
|
Serial.read();
|
|
Serial.flush();
|
|
y++;
|
|
Serial.println(names[y]);
|
|
numChars = numChar(names[y]);
|
|
Serial.println(numChars);
|
|
x = 15;
|
|
}
|
|
|
|
pixo.fillScreen(0);
|
|
pixo.setCursor(x, 10);
|
|
pixo.print(F(names[y]));
|
|
if (--x < numChars * -11) {
|
|
x = pixo.width();
|
|
if (++pass >= 30) pass = 0;
|
|
//pixo.setTextColor(colors[pass]);
|
|
}
|
|
pixo.show();
|
|
|
|
delay(15);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SinglePix() {
|
|
for (int x = 0; x < 256; x++) {
|
|
pixo.setPixelColor(x, 255, 255, 255);
|
|
delay(10);
|
|
pixo.show();
|
|
delay(200);
|
|
}
|
|
}
|
|
|
|
void RandomPix() {
|
|
randomSeed(A1);
|
|
int x = random(0, 256);
|
|
pixo.fillScreen(0);
|
|
pixo.setPixelColor(x, 255, 255, 255);
|
|
pixo.show();
|
|
delay(50);
|
|
}
|
|
|
|
void notification() {
|
|
for (int j = 15; j >= 0; j--) {
|
|
pixo.fillScreen(0);
|
|
for (int i = 0; i < 256; i++) {
|
|
pixo.setPixelColor(i + (j * 16), patreon[i][0], patreon[i][1], patreon[i][2]);
|
|
//Serial.println(i);
|
|
//delay(1);
|
|
}
|
|
pixo.show();
|
|
delay(15);
|
|
}
|
|
delay(1000);
|
|
for (int j = 0; j >= -16; j--) {
|
|
pixo.fillScreen(0);
|
|
for (int i = 0; i < 256; i++) {
|
|
pixo.setPixelColor(i + (j * 16), patreon[i][0], patreon[i][1], patreon[i][2]);
|
|
}
|
|
pixo.show();
|
|
delay(15);
|
|
}
|
|
delay(1000);
|
|
pixo.fillScreen(0);
|
|
pixo.show();
|
|
}
|
|
|
|
|
|
int numChar(char* array) {
|
|
return strlen(array);
|
|
}
|