#include <NeoPixel.h>

#define PIN        2 // P0_0
#define NUMPIXELS  1

NeoPixel pixels(NUMPIXELS, PIN);

uint8_t red = 0xff;
uint8_t green = 0x00;
uint8_t blue = 0x00;
uint8_t white = 0x00;

void setup() {
  // init pin for led control
  pixels.begin();
}

void loop() {
  // clear pixels colors
  pixels.clear();

  // set new color and show it
  for(int i=0; i<NUMPIXELS; i++) {
    pixels.setPixelColor(i, pixels.Color(red, green, blue));
    pixels.show();
  }
  delay(1000);
  // update color to set
  if (white == 0xff) {
    red = 0xff;
    green = blue = white = 0x00;
  }else if (red == 0xff) {
    green = 0xff;
    red = blue = 0x00;
  }else if (green == 0xff) {
    blue = 0xff;
    red = green = 0x00;
  }else if (blue == 0xff) {
    white = 0xff;
    red = green = blue = 0xff;
  }
}
