Last active
September 29, 2016 13:53
-
-
Save terrag42/6db4086531afb29e49dd3d9deba5bcd7 to your computer and use it in GitHub Desktop.
Reverse engineering the Small Airship LED DJ party light (8x8 matrix)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This site could be helpful: http://www.binaryhexconverter.com/binary-to-decimal-converter | |
#define data_pin 12 | |
#define latch_pin 13 | |
#define clock_pin 14 | |
void setup() | |
{ | |
int shift = 0; | |
Serial.begin(9600); | |
pinMode(data_pin, OUTPUT); | |
pinMode(latch_pin, OUTPUT); | |
pinMode(clock_pin, OUTPUT); | |
digitalWrite(latch_pin, LOW); | |
for (int i=0;i<8;i++){ //clear the display by shifting out 64 ones | |
shiftOut(data_pin, clock_pin, LSBFIRST, 255);} | |
for (int i=0;i<8;i++){ //display columns | |
shiftOut(data_pin, clock_pin, LSBFIRST, 0); | |
digitalWrite(latch_pin, HIGH); | |
delay(500); | |
digitalWrite(latch_pin, LOW);} | |
for (int i=0;i<8;i++){ //clear the display by shifting out 64 ones | |
shiftOut(data_pin, clock_pin, LSBFIRST, 255); | |
digitalWrite(latch_pin, HIGH); | |
delay(500); | |
digitalWrite(latch_pin, LOW);} | |
Serial.println("..."); | |
Serial.println("display cleared!"); | |
for (int i=0;i<65;i++){ | |
for (int i=0;i<8;i++){ //shift out increasing numbers | |
shiftOut(data_pin, clock_pin, LSBFIRST, shift); | |
digitalWrite(latch_pin, HIGH); | |
delay(100); | |
digitalWrite(latch_pin, LOW);} | |
Serial.print("Shifting "); | |
Serial.println(shift); | |
shift++; | |
} | |
// shiftOut(data_pin, clock_pin, LSBFIRST, 0); //shift out the first 0 | |
// Serial.println("LED number 0"); | |
// digitalWrite(latch_pin, HIGH); | |
} | |
uint8_t LEDnum = 0; | |
void loop(){ | |
int shift=0; | |
if (Serial.available() > 0) { //type anything into the serial monitor to advance to the next LED | |
shift = Serial.read(); | |
advanceLED(LEDnum, shift); | |
LEDnum++; | |
} | |
if (LEDnum >= 64){ | |
shiftOut(data_pin, clock_pin, LSBFIRST, 0); //shift out the first 0 | |
LEDnum = 0; | |
} | |
} | |
void advanceLED(uint8_t i, int shift){ | |
digitalWrite(latch_pin, LOW); | |
shiftOut(data_pin, clock_pin, LSBFIRST, shift); | |
digitalWrite(latch_pin, HIGH); | |
Serial.print("LED number "); | |
Serial.println(i); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment