Here is a link to the video of an LED matrix display cycling through patterns using code shifted to the 595's from the Trinket.
At this point I am honestly not sure which bits are corresponding with which pins on the LED matrix, but I am about to actually pay attention to what I am doing and make a drawing. More to come, I hope to get text characters to display before the end of the night!
Here is the code I am using, ripped off from the ShiftOut tutorial on the Arduino site:
//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;
int outputVal = 127;
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);
outputVal = 0;
for (int i=0 ; i < 256 ; i++){
Serial.println(i);
digitalWrite(latchPin, LOW);
// shift out the bits:
shiftOut(dataPin, clockPin, MSBFIRST, i);
shiftOut(dataPin, clockPin, LSBFIRST, i);
//take the latch pin high so the LEDs will light up:
digitalWrite(latchPin, HIGH);
// pause before next value:
delay(5); //extra fast for dazzlin'
digitalWrite(ledPin, HIGH);
delay(5);
}
}
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.