Zitat von cad435
Beitrag anzeigen
Gruß, Waldemar
void TDD_Module::loop1() { if (millis() - lastTimeLEDRun >= LEDFPSTime_ms) //If the time is up, run the LED's { FixedFPSLedLoop(); //Run the LED's lastTimeLEDRun = millis(); //Set the last time the LED was run to the current time } }
void TDD_Module::FixedFPSLedLoop() { switch (ledState) //Switch the LED state { case STATIC: //If the LED's are static, do nothing break; case TODO: //If the LED's are sheduled for a change, prepare memcpy(leds_Original, leds_Current, RGB_LED_COUNT); //Copy the current LED's to the original LED's fadingAmount = 0; //Set the fading amount to 0 ledState = RUNNING; //Set the LED state to running break; case RUNNING: //If the LED's are running, run them if (fadingAmount > 255) fadingAmount = 255; //If the fading amount is greater than 255, set it to 255 blend( leds_Original, leds_Target, leds_Current, RGB_LED_COUNT, (fract8)fadingAmount); //Blend the LED's to the target color fadingAmount += TTD_LED_TRANSITION_DELTA; //Increase the fading amount if (fadingAmount >= 255) //If the fading amount is greater than or equal to 255, set the LED's to the target color { memcpy(leds_Current, leds_Target, RGB_LED_COUNT); //Copy the target LED's to the current LED's ledState = STATIC; //Set the LED state to static } FastLED.show(); //Show the LED's break; default: break; } }
Wir verarbeiten personenbezogene Daten über die Nutzer unserer Website mithilfe von Cookies und anderen Technologien, um unsere Dienste bereitzustellen. Weitere Informationen findest Du in unserer Datenschutzerklärung.
Indem Du unten auf "ICH stimme zu" klickst, stimmst Du unserer Datenschutzerklärung und unseren persönlichen Datenverarbeitungs- und Cookie-Praktiken zu, wie darin beschrieben. Du erkennst außerdem an, dass dieses Forum möglicherweise außerhalb Deines Landes gehostet wird und bist damit einverstanden, dass Deine Daten in dem Land, in dem dieses Forum gehostet wird, gesammelt, gespeichert und verarbeitet werden.
Kommentar