more changes to multiplex LEDs

This commit is contained in:
Alexander Richter 2023-09-16 16:50:36 +02:00
parent 8346f020d9
commit 21699f23f9

View File

@ -924,23 +924,26 @@ void multiplexLeds() {
pinMode(LedGndPins[i], OUTPUT);
digitalWrite(LedGndPins[i], HIGH); // Set to HIGH to disable all GND Pins
}
if(ledStates[currentLED]==1){
digitalWrite(LedVccPins[currentLED%numVccPins],ledStates[currentLED]);
if(ledStates[currentLED]==1){//turn active LEDs on.
digitalWrite(LedVccPins[currentLED%numVccPins],HIGH);
digitalWrite(LedGndPins[currentLED/numVccPins],LOW);
delayMicroseconds(interval);
#ifdef DEBUG
Serial.print(currentLED%numVccPins); //row
Serial.print("/ ");
Serial.print(" % row ;/ col");
Serial.print(currentLED/numVccPins); //column
Serial.print(" wrt ");
Serial.print(ledStates[currentLED]); //row
Serial.print(" write ");
Serial.print(ledStates[currentLED]); //LED State
Serial.println(" /");
#endif
}
currentLED++;
/*
if (currentMillis - previousMillis >= interval) { // Check if it's time to update the LED matrix
previousMillis = currentMillis; // Save the last update time
currentLED++;
}
*/
if(currentLED >= numVccPins*numGndPins){
currentLED= 0;
}