GELÖST: Wordclock mit WS2812B LEDs: Farbwechsel per Button

Hallo Postmaster,

hier der "aktuelle" Teil des Sketches:

// Pattern 1 - White light, all LEDs in the strip are white
void pattern1() {
leds*.setRGB(255, 255, 255); // White*

  • FastLED.show();*
    }
    // Pattern 2 - Red light, all LEDs in the strip are white
    void pattern2() {
    _ leds*.setRGB(255, 0, 255); // Red*_
    * FastLED.show();*
    }
    void Rainbow(){
    * // FastLED's built-in rainbow generator*
    * // random colored speckles that blink in and fade smoothly*
    * fadeToBlackBy( leds, NUM_LEDS, 10);
    int pos = random16(NUM_LEDS);
    leds[pos] += CHSV( random8(64), 200, 255);
    FastLED.show();
    _
    }_
    void loop() {
    _ / Schleifen Funktion, die die Uhrzeit ausliest_

    * und dann in die entsprechende Funktionen übergibt.*
    _ /_
    _
    Minute = minute();_
    _
    int Std = hour();_
    _
    if (Std > 12)_
    _
    Stunde = Std - 12;_
    _
    else if (Std == 0)_
    _
    Stunde = 12;_
    _
    else*_
    * Stunde = Std;*
    * CheckDST();*
    * displaytime();*
    * FastLED.delay(250);*
    * Serial.println(Stunde);*
    * Serial.println(Minute);*
    /*Button
    * // read that state of the pushbutton value;*
    * int buttonVal = digitalRead(buttonPin);*
    * if (buttonVal == LOW && oldButtonVal == HIGH) {*
    * // button has just been pressed*
    * lightPattern = lightPattern + 1;*
    * }*
    * if (lightPattern > nPatterns) lightPattern = 1;*
    * oldButtonVal = buttonVal;*
    */
    * bool buttonVal = digitalRead(buttonPin);*
    * if (!buttonVal && oldButtonVal) {*
    * // button has just been pressed*
    * colorindex = (colorindex + 1) % 16;*
    * Serial.print("colorindex ");*
    * Serial.println(colorindex);*
    * }*
    * oldButtonVal = buttonVal;*

* switch (colorindex) {*
* case 1:*
* pattern1();*
* break;*
* case 2:*
* Rainbow();*
* break;*
* case 3:*
* pattern2();*
* break;*
* }*
}
[/quote]
Danke
Arne