Friday, January 16, 2015

Final Project - Megan and Becca

Our project is a light-up table that fits inside a game board box. The code consists of 23 RGB LEDs, which light up in a GRB sequence.We controlled the color like so: (G,R,B).  The operating LEDs snake around the board, building to the same color and then restart to change to a different color from the first LED. The color order goes red, green, blue, yellow, and white, then randomly begins to flash half the board in an unpredictable sequence, and then begins over with red.

CODE:


#include <Adafruit_NeoPixel.h>


#define PIN            7


#define NUMPIXELS      23


Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

int delayval = 250;

void setup() {
  pixels.begin();
}

void loop() {
 
  for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(0,150,0));
    pixels.show();
    delay(delayval);
  }
    for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(150,0,0));
    pixels.show();
    delay(delayval);
  }
    for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(0,0,150));
    pixels.show();
    delay(delayval);
 
  }
    for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(150,150,0));
    pixels.show();
    delay(delayval);
  }
    for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(122,122,122));
    pixels.show();
    delay(delayval);
  }
    for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(0,150,0));
    pixels.show();
    delay(delayval);
  }
}


The pictures and video for this project were emailed to you, because we could not get them to upload onto the blog itself.