pixopixel/FIRMWARE/PIXO_WIP/PIXO_WIP.ino

196 lines
12 KiB
Arduino
Raw Permalink Normal View History

2018-02-14 01:32:00 +00:00
/*
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.
*/
2018-02-01 00:29:16 +00:00
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_DotStarMatrix.h>
#include <Adafruit_DotStar.h>
2018-06-21 12:17:27 +00:00
#include <Fonts/FreeMonoOblique9pt7b.h>
2018-02-01 00:29:16 +00:00
#include "image.h"
2018-06-21 12:17:27 +00:00
2018-02-01 00:29:16 +00:00
#define DATAPIN 19
#define CLOCKPIN 18
2018-06-21 12:17:27 +00:00
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}"
};
2018-02-14 01:32:00 +00:00
2018-02-01 00:29:16 +00:00
2018-06-21 12:17:27 +00:00
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
2018-02-01 00:29:16 +00:00
// MATRIX DECLARATION:
2018-02-14 01:32:00 +00:00
Adafruit_DotStarMatrix pixo = Adafruit_DotStarMatrix(
2018-06-21 12:17:27 +00:00
16, 16, DATAPIN, CLOCKPIN,
DS_MATRIX_TOP + DS_MATRIX_LEFT +
DS_MATRIX_ROWS + DS_MATRIX_PROGRESSIVE,
DOTSTAR_BGR);
2018-02-01 00:29:16 +00:00
2018-06-21 12:17:27 +00:00
const uint16_t colors[] = {
pixo.Color(100, 100, 100), pixo.Color(0, 100, 0), pixo.Color(0, 0, 100)
2018-02-01 00:29:16 +00:00
};
2018-06-21 12:17:27 +00:00
int x = pixo.width();
int pass = 0;
int y = 0;
int numChars = 0;
2018-02-01 00:29:16 +00:00
void setup() {
Serial.begin(115200);
// uncomment to have wait
//while (!Serial) delay(500);
2018-02-14 01:32:00 +00:00
pixo.begin();
2018-06-21 12:17:27 +00:00
pixo.setTextWrap(false);
2018-02-14 01:32:00 +00:00
pixo.setBrightness(BRIGHTNESS);
2018-06-21 12:17:27 +00:00
pixo.setFont(&FreeMonoOblique9pt7b);
pixo.setTextColor(colors[pass]);
Serial.println(names[y]);
numChars = numChar(names[y]);
Serial.println(numChars);
//while(!Serial);
2018-02-01 00:29:16 +00:00
}
2018-06-21 12:17:27 +00:00
2018-02-01 00:29:16 +00:00
void loop() {
2018-06-21 12:17:27 +00:00
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);
2018-02-14 01:32:00 +00:00
}
2018-02-01 00:29:16 +00:00
2018-06-21 12:17:27 +00:00
2018-02-14 01:32:00 +00:00
void SinglePix() {
for (int x = 0; x < 256; x++) {
pixo.setPixelColor(x, 255, 255, 255);
2018-02-01 00:29:16 +00:00
delay(10);
2018-02-14 01:32:00 +00:00
pixo.show();
2018-02-01 00:29:16 +00:00
delay(200);
2018-02-14 01:32:00 +00:00
}
2018-02-01 00:29:16 +00:00
}
2018-02-14 01:32:00 +00:00
void RandomPix() {
2018-02-01 00:29:16 +00:00
randomSeed(A1);
2018-02-14 01:32:00 +00:00
int x = random(0, 256);
pixo.fillScreen(0);
pixo.setPixelColor(x, 255, 255, 255);
pixo.show();
delay(50);
2018-02-01 00:29:16 +00:00
}
2018-02-14 01:32:00 +00:00
void notification() {
for (int j = 15; j >= 0; j--) {
pixo.fillScreen(0);
for (int i = 0; i < 256; i++) {
2018-06-21 12:17:27 +00:00
pixo.setPixelColor(i + (j * 16), patreon[i][0], patreon[i][1], patreon[i][2]);
2018-02-14 01:32:00 +00:00
//Serial.println(i);
//delay(1);
}
pixo.show();
delay(15);
2018-02-01 00:29:16 +00:00
}
delay(1000);
2018-02-14 01:32:00 +00:00
for (int j = 0; j >= -16; j--) {
pixo.fillScreen(0);
for (int i = 0; i < 256; i++) {
2018-06-21 12:17:27 +00:00
pixo.setPixelColor(i + (j * 16), patreon[i][0], patreon[i][1], patreon[i][2]);
2018-02-14 01:32:00 +00:00
}
pixo.show();
delay(15);
2018-02-01 00:29:16 +00:00
}
delay(1000);
2018-02-14 01:32:00 +00:00
pixo.fillScreen(0);
pixo.show();
2018-02-01 00:29:16 +00:00
}
2018-06-21 12:17:27 +00:00
int numChar(char* array) {
return strlen(array);
}