Ok here goes! This was my partner who is still learning, so the smoothColor(); doesn’t work yet. The teamWheel() workes and is pretty cool. You can use that if you wan’t.
#include <Adafruit_NeoPixel.h>
#ifdef AVR
#include <avr/power.h>
#endif
#include <SoftwareSerial.h>
#define PIN 7
// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic ‘v1’ (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
// NEO_RGBW Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRBW + NEO_KHZ800);
const int rioPin0 = 3;
const int rioPin1 = 4;
const int rioPin2 = 5;
int digIn = 0;
bool isblue = false;
uint8_t count = 0;
int i = 0;
void setup() {
// put your setup code here, to run once:
pinMode(rioPin0, INPUT);
pinMode(rioPin1, INPUT);
pinMode(rioPin2, INPUT);
strip.begin();
strip.show();
}
void loop() {
// put your main code here, to run repeatedly:
// If you make digIn = to (digitalRead(rioPin2)<< 2) | (digitalRead(rioPin1)<< 1) | digitalRead(rioPin0); it will take the input to those pins. This is how you get the info. The digIn was just set to 1 to test.
digIn =1;
switch (digIn) {
case 0:
smoothColor(10);
break;
case 1:
setFullColor(strip.Color(0, 255, 0));
delay(100);
break;
case 2:
setFullColor(strip.Color(0, 0, 255));
delay(100);
break;
case 3:
colorWipe(strip.Color(255, 0, 0), 10);
setFullColor(strip.Color(0, 0, 0));
break;
case 4:
colorWipe(strip.Color(0, 255, 0), 10);
setFullColor(strip.Color(0, 0, 0));
break;
case 5:
colorWipe(strip.Color(0, 0, 255), 10);
setFullColor(strip.Color(0, 0, 0));
break;
case 6:
colorWipe(strip.Color(255, 255, 0), 10);
setFullColor(strip.Color(0, 0, 0));
break;
case 7:
colorWipe(strip.Color(255, 255, 255), 10);
setFullColor(strip.Color(0, 0, 0));
break;
default:
teamWheel(20, 5);
break;
}
}
void teamWheel(uint8_t wait, uint16_t colorAmount) {
//Serial.print(“starting wheel”);
for (uint16_t i=strip.numPixels()-1; i>0; i–) {
strip.setPixelColor(i, strip.getPixelColor(i-1));
}
uint32_t color = strip.Color(255, 125, 0);
if (isblue) {
color = strip.Color(0, 0, 200 );
}
strip.setPixelColor(0, color);
count++;
if (count >=colorAmount){
count = 0;
isblue = !isblue;
}
strip.show();
delay(wait);
}
void colorWipe(uint32_t c, uint8_t wait) {
for(uint16_t i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, c);
strip.show();
delay(wait);
}
}
void setFullColor(uint32_t c) {
for(uint16_t i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, c);
//strip.show();
}
strip.show();
// you need strip.show(); if you want the LED’s to turn on at all.
}
void smoothColor(uint32_t color) {
for (uint32_t i=0; i>225; i++){
setFullColor(strip.Color(i, 0, 0));
strip.show();
delay (color);
}
for(uint32_t i=0; i>225; i++){
setFullColor(strip.Color(255, i, 0));
strip.show();
delay(color);
}
for(uint32_t i=255; i<0; i–){
setFullColor(strip.Color(i, 255, 0));
strip.show();
delay(color);
}
for(uint32_t i=255; i<0; i–){
setFullColor(strip.Color(0, i, 0));
strip.show();
delay(color);
}
}