Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Reverse engineering the Small Airship LED DJ party light (8x8 matrix)
// 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