Skip to content

Instantly share code, notes, and snippets.

@sbcohen
sbcohen / Aurora Borealis Swoop.ino
Last active August 29, 2015 14:25
For 16x32 LED matrix
//Swoop 1, direction 1
if (ypos1 > 6){
//draw two pixels
matrix.drawPixel(xpos1, ypos1, matrix.Color888(0, 255, 0));
matrix.drawPixel(xpos2, ypos2, matrix.Color888(0, 255, 0));
delay(64);
//increment x and y positions of each pixel
xpos1++;
xpos2++;
ypos1 = ypos1 - 2;
@sbcohen
sbcohen / Aurora Borealis Streak.ino
Last active August 29, 2015 14:25
For 16x32 LED matrix
// Streak 1
if(y1 != YOFFBOARD && shouldFade == 0){
// start from top, move down
matrix.drawPixel(6, y1, matrix.Color888(204, 255, 229));
// wait one frame
delay(FRAME);
// reset that current pixel
matrix.drawPixel(6, y1, matrix.Color888(0, 0, 0));
// increment y to go up 1 (down board)
y1++;
@sbcohen
sbcohen / Aurora Borealis Reset.ino
Last active August 29, 2015 14:25
For 16x32 LED matrix
//This is just a portion of the reset function because there were so many variables. But you get the gist.
void reset(){
for (int x=0; x < 32; x++) {
for (int y=0; y < 16; y++) {
matrix.drawPixel(x,y, matrix.Color888(0, 0, 0));
}
}
shouldFade = 1;
//Streak Variables
y1 = Y1MIN;
@sbcohen
sbcohen / Aurora Borealis Setup.ino
Last active August 29, 2015 14:25
For 16x32 LED matrix
#include <Adafruit_GFX.h> // Core graphics library
#include <RGBmatrixPanel.h> // Hardware-specific library
//These initialize the pins on the Arduino to control the LED board
#define CLK 8 // MUST be on PORTB! (Use pin 11 on Mega)
#define LAT A3
#define OE 9
#define A A0
#define B A1
#define C A2