/*******************************************************************************
    PocketScreen "LED Colors" Example
    written by Florian Keller
    last changed 20 Nov 20

    Loops through the three LED colors.
*******************************************************************************/

#include <PocketScreen.h>
PocketScreen pocketscreen = PocketScreen();

// variables to save the current color, and the last time the color changed
int color = 0;
int timeLastColorChange = 0;

void setup() {
    // init pocketscreen
    pocketscreen.begin();
}

void loop() {
    // change color every 500 ms
    int time = millis();
    if (time - timeLastColorChange > 500) {
        timeLastColorChange = time;

        color = color + 1;
        if (color == 3)
            color = 0;

        // set LED color depending on the 'color' variable
        if      (color == 0) pocketscreen.setLEDColor(LEDRed);
        else if (color == 1) pocketscreen.setLEDColor(LEDGreen);
        else if (color == 2) pocketscreen.setLEDColor(LEDBlue);
    }
}
