mirror of
https://github.com/alopexc0de/pixopixel.git
synced 2024-12-26 15:02:39 +00:00
92 lines
5.0 KiB
Arduino
92 lines
5.0 KiB
Arduino
|
/*
|
||
|
PIXO Pixel Display 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/TomThumb.h>
|
||
|
|
||
|
|
||
|
#define DATAPIN 19
|
||
|
#define CLOCKPIN 18
|
||
|
|
||
|
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}};
|
||
|
|
||
|
|
||
|
#define BRIGHTNESS 70
|
||
|
|
||
|
// MATRIX DECLARATION:
|
||
|
Adafruit_DotStarMatrix pixo = Adafruit_DotStarMatrix(
|
||
|
16, 16, DATAPIN, CLOCKPIN,
|
||
|
DS_MATRIX_BOTTOM + DS_MATRIX_LEFT +
|
||
|
DS_MATRIX_ROWS + DS_MATRIX_PROGRESSIVE,
|
||
|
DOTSTAR_BGR);
|
||
|
|
||
|
const uint16_t primaryColors[] = {
|
||
|
pixo.Color(150, 0, 0), pixo.Color(0, 150, 0), pixo.Color(0, 0, 150)
|
||
|
};
|
||
|
|
||
|
|
||
|
void setup() {
|
||
|
Serial.begin(115200);
|
||
|
|
||
|
// uncomment to have wait
|
||
|
//while (!Serial) delay(500);
|
||
|
|
||
|
pixo.begin();
|
||
|
pixo.setBrightness(BRIGHTNESS);
|
||
|
for (byte i = 0; i < 3; i++) {
|
||
|
pixo.fillScreen(primaryColors[i]);
|
||
|
pixo.show();
|
||
|
delay(500);
|
||
|
pixo.fillScreen(0);
|
||
|
pixo.show();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
int x = pixo.width();
|
||
|
int pass = 0;
|
||
|
|
||
|
void loop() {
|
||
|
pixo.setBrightness(BRIGHTNESS);
|
||
|
//SinglePix();
|
||
|
for (byte i = 0; i < 3; i++) {
|
||
|
pixo.fillScreen(primaryColors[i]);
|
||
|
pixo.show();
|
||
|
delay(500);
|
||
|
pixo.fillScreen(0);
|
||
|
pixo.show();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
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);
|
||
|
}
|
||
|
|
||
|
|