Close

LED Matrix Fun!

A project log for Stylin' safety jacket.

I always feel like jackets needed more blinky sh*t. Now dreams become reality.

scissorfeindScissorfeind 12/10/2014 at 09:230 Comments

I did more testing and was able to get the display to work POV style so I can get crazy with the patterns and text n stuff. Tomorrow I will work on getting multiple displays and actual text but for now, here are two videos I made to demonstrate the effect; One where I fail to demonstrate the principle, and a second where I fail to explain it.

I have the LDR set up to control the speed of the display when flashing between two 'frames (?)' so you can watch the point where the two images blur together :D!

Hear me explain it and almost roast my LDR:

https://drive.google.com/file/d/0B4NTxdyFQRYlSXZYaUEwdV9UZFU/view?usp=sharing

Watch it happen:

https://drive.google.com/file/d/0B4NTxdyFQRYlVU92ekFGT1ZRdVk/view?usp=sharing

Here is my code, again pretty much ripped from the Arduino website. One super important thing you can see is where I commented out all those serial messages, which are handy when debugging but take so much time they prevent you from flashing frames fast enough to confuse ya' brain. Another important part about this code structure is that it isn't really easy to make frames with, however it seems fine with me since I don't want to add more memory for too many animations and I like random patterns.

//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
////Pin connected to DS of 74HC595
int dataPin = 11;
int ledPin = 13;
byte firstByte[] = { 42,0,42,0,21,0,21,0 };
byte secondByte[] = { 42,255,42,255,21,255,21,255 };

int sensorPin = A7;    // select the input pin for the potentiometer

int sensorValue = 0;  // variable to store the value coming from the sensor


void setup() {
  //set pins to output so you can control the shift register
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  
  digitalWrite(ledPin, LOW);
    
    for (int i=0 ; i < 8 ; i++){
      sensorValue = analogRead(sensorPin);
      /*
      Serial.print(F("i"));
    Serial.println(i);
    Serial.print(F("First Byte"));
    Serial.println(firstByte[i]);
    Serial.print(F("Second Byte"));
    Serial.println(secondByte[i]);
    */
    digitalWrite(latchPin, LOW);
    // shift out the bits:
    shiftOut(dataPin, clockPin, MSBFIRST, firstByte[i]);  
    shiftOut(dataPin, clockPin, MSBFIRST, secondByte[i]);  

    //take the latch pin high so the LEDs will light up:
    digitalWrite(latchPin, HIGH);
    // pause before next value:
    delay(sensorValue/10);
    /*
    digitalWrite(ledPin, HIGH);
    delay(0.001);
    */
    }
    
}


Discussions