Programs added

This commit is contained in:
hodginsa 2018-06-21 08:17:27 -04:00
parent 01d90ef571
commit 218800df16
5 changed files with 363 additions and 44 deletions

View File

@ -0,0 +1,91 @@
/*
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);
}

View File

@ -52,7 +52,7 @@ uint8_t backbuffer = 0,
#define SHIFTDELAY 30
#define BRIGHTNESS 20
#define BRIGHTNESS 100
@ -84,6 +84,13 @@ void setup(void) {
matrix.begin();
matrix.setBrightness(BRIGHTNESS);
screenFlash();
delay(500);
screenFlash();
delay(500);
notification();
notificationhalf();
@ -252,6 +259,14 @@ void loop() {
}
void screenFlash(){
matrix.fillScreen(matrix.Color(200, 200, 200));
matrix.show();
delay(500);
matrix.fillScreen(0);
matrix.show();
}
void notificationhalf() {
for (int j = 15; j >= 0; j--) {
matrix.fillScreen(0);

View File

@ -0,0 +1,135 @@
//--------------------------------------------------------------------------
// This code is modified from the following Adafruit tutorial: https://learn.adafruit.com/animated-led-sand/overview
/*
This code is modified from the following Adafruit tutorial: https://learn.adafruit.com/animated-led-sand/overview
This program shows an upvote arrow 3 times then on the 4th it breaks into particles that will move based on accelerometer readings.
*/
#include <Wire.h> // For I2C communication
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_DotStarMatrix.h>
#include <Adafruit_DotStar.h>
#include <ArduinoJson.h>
#include "I2Cdev.h"
#include "MPU6050.h"
MPU6050 mpu;
uint8_t upvote[256][3] = {{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, 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, 0, 0}, {0, 0, 0}, {255, 68, 0}, {255, 68, 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, 0, 0}, {0, 0, 0}, {0, 0, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 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, 0, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 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}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {0, 0, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 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}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 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}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 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}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 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}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 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}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 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}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
int sh[256][3] = {{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, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 1}, {2, 2, 2}, {3, 3, 3}, {3, 3, 3}, {2, 2, 2}, {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}, {3, 3, 3}, {3, 3, 3}, {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, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {22, 22, 22}, {58, 58, 58}, {78, 78, 78}, {86, 86, 86}, {69, 69, 69}, {5, 5, 5}, {1, 1, 1}, {3, 3, 3}, {0, 0, 0}, {2, 2, 2}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {86, 86, 86}, {154, 154, 154}, {114, 114, 114}, {73, 73, 73}, {49, 49, 49}, {40, 40, 40}, {39, 39, 39}, {6, 6, 6}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {93, 93, 93}, {163, 163, 163}, {118, 118, 118}, {65, 65, 65}, {17, 17, 17}, {0, 0, 0}, {0, 0, 0}, {1, 1, 1}, {14, 14, 14}, {52, 52, 52}, {0, 0, 0}, {35, 35, 35}, {0, 0, 0}, {2, 2, 2}, {3, 3, 3}, {2, 2, 2}, {0, 0, 0}, {0, 0, 0}, {30, 30, 30}, {74, 74, 74}, {114, 114, 114}, {122, 122, 122}, {54, 54, 54}, {0, 0, 0}, {21, 21, 21}, {211, 211, 211}, {4, 4, 4}, {174, 174, 174}, {48, 48, 48}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {3, 3, 3}, {2, 2, 2}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {32, 32, 32}, {131, 131, 131}, {108, 108, 108}, {0, 0, 0}, {183, 183, 183}, {38, 38, 38}, {136, 136, 136}, {130, 130, 130}, {41, 41, 41}, {75, 75, 75}, {78, 78, 78}, {0, 0, 0}, {0, 0, 0}, {2, 2, 2}, {0, 0, 0}, {0, 0, 0}, {20, 20, 20}, {51, 51, 51}, {199, 199, 199}, {152, 152, 152}, {199, 199, 199}, {116, 116, 116}, {110, 110, 110}, {193, 193, 193}, {51, 51, 51}, {46, 46, 46}, {25, 25, 25}, {0, 0, 0}, {1, 1, 1}, {0, 0, 0}, {61, 61, 61}, {154, 154, 154}, {123, 123, 123}, {76, 76, 76}, {53, 53, 53}, {173, 173, 173}, {155, 155, 155}, {123, 123, 123}, {0, 0, 0}, {181, 181, 181}, {4, 4, 4}, {0, 0, 0}, {0, 0, 0}, {2, 2, 2}, {0, 0, 0}, {49, 49, 49}, {209, 209, 209}, {32, 32, 32}, {0, 0, 0}, {0, 0, 0}, {117, 117, 117}, {126, 126, 126}, {53, 53, 53}, {135, 135, 135}, {1, 1, 1}, {134, 134, 134}, {63, 63, 63}, {2, 2, 2}, {3, 3, 3}, {1, 1, 1}, {1, 1, 1}, {24, 24, 24}, {124, 124, 124}, {87, 87, 87}, {75, 75, 75}, {126, 126, 126}, {143, 143, 143}, {11, 11, 11}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {53, 53, 53}, {126, 126, 126}, {0, 0, 0}, {3, 3, 3}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {25, 25, 25}, {35, 35, 35}, {24, 24, 24}, {0, 0, 0}, {0, 0, 0}, {2, 2, 2}, {3, 3, 3}, {0, 0, 0}, {0, 0, 0}, {35, 35, 35}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 1}, {2, 2, 2}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {3, 3, 3}, {1, 1, 1}, {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, 0}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 1}, {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, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
//int N_GRAINS = 0;
#define N_GRAINS 58 // Number of grains of sand
#define WIDTH 16 // Display width in pixels
#define HEIGHT 16 // Display height in pixels
#define MAX_FPS 45
#define SCALE 128
#define WBOUNCE -2
#define BBOUNCE -2
#define MAX_X (WIDTH * SCALE - 1)
#define MAX_Y (HEIGHT * SCALE - 1)
struct Grain {
int16_t x, y;
int16_t vx, vy;
} grain[N_GRAINS];
int16_t rax, ray, raz;
int16_t rgx, rgy, rgz;
uint32_t prevTime = 0;
uint8_t backbuffer = 0,
img[WIDTH * HEIGHT];
#define DATAPIN 19
#define CLOCKPIN 18
#define SHIFTDELAY 30
#define BRIGHTNESS 100
Adafruit_DotStarMatrix matrix = Adafruit_DotStarMatrix(
16, 16, DATAPIN, CLOCKPIN,
DS_MATRIX_TOP + DS_MATRIX_LEFT +
DS_MATRIX_ROWS + DS_MATRIX_PROGRESSIVE,
DOTSTAR_BGR);
void setup(void) {
uint8_t i, j, bytes;
Serial.begin(115200);
Serial.println("Thanks for Backing the PIXO Pixel!");
delay(300);
Serial.println("Go check out the build video on my YouTube!");
delay(300);
Serial.println("http://youtube.com/seanhodginsfilms");
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
Wire.begin();
#elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
Fastwire::setup(400, true);
#endif
Serial.println("Initializing I2C devices...");
mpu.initialize();
Serial.println("Testing device connections...");
Serial.println(mpu.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");
matrix.begin();
matrix.setBrightness(BRIGHTNESS);
// screenFlash();
// delay(500);
// screenFlash();
// delay(500);
//
// notification();
// notificationhalf();
memset(img, 0, sizeof(img)); // Clear the img[] array
int grain_num = 0;
for (int x = 0; x < 256; x++) {
if (sh[x][0] > 50) {
int NX = x % 16;
int NY = x / 16;
grain[grain_num].x = (NX * SCALE); // Assign random position within
grain[grain_num].y = (NY * SCALE);
grain_num++;
}
}
for (i = 0; i < N_GRAINS; i++) { // For each sand grain...
img[(grain[i].y / SCALE) * WIDTH + (grain[i].x / SCALE)] = 255; // Mark it
grain[i].vx = grain[i].vy = 0; // Initial velocity is zero
}
}
void loop() {
mpu.getMotion6(&rax, &ray, &raz, &rgx, &rgy, &rgz);
randomSeed(A7);
int16_t ax = random(-11,11); // Transform accelerometer axes
ax = ax / 10;
int16_t ay = random(-11,11); // Transform accelerometer axes
ay = ay / 10;
matrix.fillScreen(0);
Serial.println(ax);
matrix.fillCircle(8-ax, 8-ay, 2, matrix.Color(0, 150, 90));
matrix.show();
delay(50);
}

View File

@ -21,9 +21,10 @@
MPU6050 mpu;
uint8_t upvote[256][3] = {{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, 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, 0, 0}, {0, 0, 0}, {255, 68, 0}, {255, 68, 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, 0, 0}, {0, 0, 0}, {0, 0, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 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, 0, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 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}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {0, 0, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 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}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 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}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 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}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 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}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 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}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 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}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {255, 68, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
int sh[256][3] = {{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, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 1}, {2, 2, 2}, {3, 3, 3}, {3, 3, 3}, {2, 2, 2}, {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}, {3, 3, 3}, {3, 3, 3}, {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, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {22, 22, 22}, {58, 58, 58}, {78, 78, 78}, {86, 86, 86}, {69, 69, 69}, {5, 5, 5}, {1, 1, 1}, {3, 3, 3}, {0, 0, 0}, {2, 2, 2}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {86, 86, 86}, {154, 154, 154}, {114, 114, 114}, {73, 73, 73}, {49, 49, 49}, {40, 40, 40}, {39, 39, 39}, {6, 6, 6}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {93, 93, 93}, {163, 163, 163}, {118, 118, 118}, {65, 65, 65}, {17, 17, 17}, {0, 0, 0}, {0, 0, 0}, {1, 1, 1}, {14, 14, 14}, {52, 52, 52}, {0, 0, 0}, {35, 35, 35}, {0, 0, 0}, {2, 2, 2}, {3, 3, 3}, {2, 2, 2}, {0, 0, 0}, {0, 0, 0}, {30, 30, 30}, {74, 74, 74}, {114, 114, 114}, {122, 122, 122}, {54, 54, 54}, {0, 0, 0}, {21, 21, 21}, {211, 211, 211}, {4, 4, 4}, {174, 174, 174}, {48, 48, 48}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {3, 3, 3}, {2, 2, 2}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {32, 32, 32}, {131, 131, 131}, {108, 108, 108}, {0, 0, 0}, {183, 183, 183}, {38, 38, 38}, {136, 136, 136}, {130, 130, 130}, {41, 41, 41}, {75, 75, 75}, {78, 78, 78}, {0, 0, 0}, {0, 0, 0}, {2, 2, 2}, {0, 0, 0}, {0, 0, 0}, {20, 20, 20}, {51, 51, 51}, {199, 199, 199}, {152, 152, 152}, {199, 199, 199}, {116, 116, 116}, {110, 110, 110}, {193, 193, 193}, {51, 51, 51}, {46, 46, 46}, {25, 25, 25}, {0, 0, 0}, {1, 1, 1}, {0, 0, 0}, {61, 61, 61}, {154, 154, 154}, {123, 123, 123}, {76, 76, 76}, {53, 53, 53}, {173, 173, 173}, {155, 155, 155}, {123, 123, 123}, {0, 0, 0}, {181, 181, 181}, {4, 4, 4}, {0, 0, 0}, {0, 0, 0}, {2, 2, 2}, {0, 0, 0}, {49, 49, 49}, {209, 209, 209}, {32, 32, 32}, {0, 0, 0}, {0, 0, 0}, {117, 117, 117}, {126, 126, 126}, {53, 53, 53}, {135, 135, 135}, {1, 1, 1}, {134, 134, 134}, {63, 63, 63}, {2, 2, 2}, {3, 3, 3}, {1, 1, 1}, {1, 1, 1}, {24, 24, 24}, {124, 124, 124}, {87, 87, 87}, {75, 75, 75}, {126, 126, 126}, {143, 143, 143}, {11, 11, 11}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {53, 53, 53}, {126, 126, 126}, {0, 0, 0}, {3, 3, 3}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {25, 25, 25}, {35, 35, 35}, {24, 24, 24}, {0, 0, 0}, {0, 0, 0}, {2, 2, 2}, {3, 3, 3}, {0, 0, 0}, {0, 0, 0}, {35, 35, 35}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 1}, {2, 2, 2}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {3, 3, 3}, {1, 1, 1}, {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, 0}, {1, 1, 1}, {1, 1, 1}, {1, 1, 1}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 1}, {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, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
//int N_GRAINS = 0;
#define N_GRAINS 114 // Number of grains of sand
#define N_GRAINS 58 // Number of grains of sand
#define WIDTH 16 // Display width in pixels
#define HEIGHT 16 // Display height in pixels
#define MAX_FPS 45
@ -79,15 +80,13 @@ void setup(void) {
matrix.begin();
matrix.setBrightness(BRIGHTNESS);
notification();
notification();
notification();
notificationhalf();
memset(img, 0, sizeof(img)); // Clear the img[] array
int grain_num = 0;
for (int x = 0; x < 256; x++) {
if (upvote[x][0] > 0) {
if (sh[x][0] > 50) {
int NX = x % 16;
int NY = x / 16;
@ -117,8 +116,8 @@ void loop() {
mpu.getMotion6(&rax, &ray, &raz, &rgx, &rgy, &rgz);
randomSeed(A7);
int16_t ax = -rax / SCALE, // Transform accelerometer axes
ay = ray / SCALE, // to grain coordinate space
int16_t ax = -ray / SCALE, // Transform accelerometer axes
ay = -rax / SCALE, // to grain coordinate space
az = abs(raz) / 128; // Random motion factor
az = (az >= 3) ? 1 : 4 - az; // Clip & invert
@ -245,7 +244,7 @@ void loop() {
for (int i = 0; i < N_GRAINS; i++) {
int x = grain[i].x / SCALE;
int y = grain[i].y / SCALE;
matrix.drawPixel(x, y, matrix.Color(205, 110, 0));
matrix.drawPixel(x, y, matrix.Color(150, 150, 150));
}
matrix.show();
@ -257,7 +256,7 @@ void notificationhalf() {
for (int j = 15; j >= 0; j--) {
matrix.fillScreen(0);
for (int i = 0; i < 256; i++) {
matrix.setPixelColor(i + (j * 16), upvote[i][0], upvote[i][1], upvote[i][2]);
matrix.setPixelColor(i + (j * 16), sh[i][0], sh[i][1], sh[i][2]);
}
matrix.show();
delay(15);
@ -269,7 +268,7 @@ void notification() {
for (int j = 15; j >= 0; j--) {
matrix.fillScreen(0);
for (int i = 0; i < 256; i++) {
matrix.setPixelColor(i + (j * 16), upvote[i][0], upvote[i][1], upvote[i][2]);
matrix.setPixelColor(i + (j * 16), sh[i][0], sh[i][1], sh[i][2]);
}
matrix.show();
delay(15);
@ -278,7 +277,7 @@ void notification() {
for (int j = 0; j >= -16; j--) {
matrix.fillScreen(0);
for (int i = 0; i < 256; i++) {
matrix.setPixelColor(i + (j * 16), upvote[i][0], upvote[i][1], upvote[i][2]);
matrix.setPixelColor(i + (j * 16),sh[i][0], sh[i][1], sh[i][2]);
}
matrix.show();
delay(15);

View File

@ -11,29 +11,90 @@
#include <Adafruit_GFX.h>
#include <Adafruit_DotStarMatrix.h>
#include <Adafruit_DotStar.h>
#include <Fonts/TomThumb.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 30
#define BRIGHTNESS 150
// MATRIX DECLARATION:
Adafruit_DotStarMatrix pixo = Adafruit_DotStarMatrix(
16, 16, DATAPIN, CLOCKPIN,
DS_MATRIX_BOTTOM + DS_MATRIX_LEFT +
DS_MATRIX_TOP + DS_MATRIX_LEFT +
DS_MATRIX_ROWS + DS_MATRIX_PROGRESSIVE,
DOTSTAR_BGR);
const uint16_t primaryColors[] = {
pixo.Color(100, 0, 0), pixo.Color(0, 100, 0), pixo.Color(0, 0, 100)
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);
@ -41,29 +102,50 @@ void setup() {
//while (!Serial) delay(500);
pixo.begin();
pixo.setTextWrap(false);
pixo.setBrightness(BRIGHTNESS);
for (byte i = 0; i < 3; i++) {
pixo.fillScreen(primaryColors[i]);
pixo.show();
delay(500);
pixo.fillScreen(0);
pixo.show();
}
pixo.setFont(&FreeMonoOblique9pt7b);
pixo.setTextColor(colors[pass]);
Serial.println(names[y]);
numChars = numChar(names[y]);
Serial.println(numChars);
//while(!Serial);
}
int x = pixo.width();
int pass = 0;
void loop() {
pixo.setBrightness(BRIGHTNESS);
//while(1){
//SinglePix();
// RandomPix();
//}
notification();
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);
@ -86,7 +168,7 @@ void notification() {
for (int j = 15; j >= 0; j--) {
pixo.fillScreen(0);
for (int i = 0; i < 256; i++) {
pixo.setPixelColor(i + (j * 16), mario[i][0], mario[i][1], mario[i][2]);
pixo.setPixelColor(i + (j * 16), patreon[i][0], patreon[i][1], patreon[i][2]);
//Serial.println(i);
//delay(1);
}
@ -97,7 +179,7 @@ void notification() {
for (int j = 0; j >= -16; j--) {
pixo.fillScreen(0);
for (int i = 0; i < 256; i++) {
pixo.setPixelColor(i + (j * 16), mario[i][0], mario[i][1], mario[i][2]);
pixo.setPixelColor(i + (j * 16), patreon[i][0], patreon[i][1], patreon[i][2]);
}
pixo.show();
delay(15);
@ -107,10 +189,7 @@ void notification() {
pixo.show();
}
float ballx = 5;
float bally = 5;
float paddle1, paddle2 = 3;
float ballvx = -0.3;
float ballvy = 0.1;
int numChar(char* array) {
return strlen(array);
}