Skip to content

Instantly share code, notes, and snippets.

@vschlegel
Created March 26, 2016 10:01
Show Gist options
  • Save vschlegel/b35a9cb2f254ff5848e2 to your computer and use it in GitHub Desktop.
Save vschlegel/b35a9cb2f254ff5848e2 to your computer and use it in GitHub Desktop.
Steuert eine LED Matrix an, die direkt mit einem Arduino Nano verbunden ist.
//LED_Matrix.ino
//v.schlegel.grunholz@Gmail.com
int zeile[8] = {2,10,18,8,13,15,16,17}; //Zeilen, Active HIGH
int spalte[8] = {3,19,14,4,7,5,9,6}; //Spalten, Active LOW
//Eine Led wird aktiviert, wenn ihre Zeile auf HIGH und ihre Spalte auf LOW gesetzt wird.
//Hardwarebedingt muss die Matrix so angesteuert werden, dass nacheinander Zeilen ausgegeben werden.
void setup() {
ledsaufoutput();
ledsaus();
}
void loop() {
//HIER KÖNNTE IHR PROGRAMM STEHEN!
}
int ledsaufoutput() {
for (int i=0; i < 8; i++) {
pinMode(zeile[i],OUTPUT);
pinMode(spalte[i], OUTPUT);
}
}
int ledsaus() {
for (int i=0; i < 8; i++) {
digitalWrite(zeile[i], LOW);
digitalWrite(spalte[i], HIGH);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment