Skip to content

Instantly share code, notes, and snippets.

@RodrigoSC
Created March 1, 2017 15:25
Show Gist options
  • Save RodrigoSC/293a04a1e7a8afdd3ba9dc855cda14de to your computer and use it in GitHub Desktop.
Save RodrigoSC/293a04a1e7a8afdd3ba9dc855cda14de to your computer and use it in GitHub Desktop.
LedMatrix.ino
byte character[8]={0x3c, 0x42, 0xa5, 0x81, 0xa5, 0x99, 0x42, 0x3c};
uint8_t rowPins[8]={10,11,12,13,A0,A1,A2,A3};
uint8_t colPins[8]={ 2, 3, 4, 5, 6, 7, 8, 9};
void setup() {
// Turn everything to low
for(int i=0; i<8; i++) {
pinMode(colPins[i],OUTPUT);
pinMode(rowPins[i],OUTPUT);
}
}
void loop() {
for(int row=0; row<8; row++) { // iterate each row
for(int k=0; k<8; k++) digitalWrite(colPins[k],HIGH); // Cleanup cols
digitalWrite(rowPins[row], HIGH); // prepare to write the row
for(int col=0; col<8; col++) {
digitalWrite(colPins[7-col], character[row] & 1 << col ? LOW : HIGH);
}
delay(1);
digitalWrite(rowPins[row],LOW);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment