Code: Select all
// NeoPixel Ring simple sketch (c) 2013 Shae Erisson
// released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
// Which pin on the Arduino is connected to the Neobig?
// On a Trinket or Gemma we suggest changing this to 1
#define bigPIN 11
#define smallPIN 12
// How many Neobig are attached to the Arduino?
#define NUMbig 24
// When we setup the NeoPixel library, we tell it how many big, and which pin to use to send signals.
// Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest
// example for more information on possible values.
Adafruit_NeoPixel big = Adafruit_NeoPixel(NUMbig, bigPIN, NEO_GRBW + NEO_KHZ800);
Adafruit_NeoPixel small = Adafruit_NeoPixel(NUMbig, smallPIN, NEO_GRB + NEO_KHZ800);
int delayval = 50; // delay for half a second
void setup() {
// This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
//#if defined (__AVR_ATtiny85_ _)
// if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
//#endif
// End of trinket special code
big.begin(); // This initializes the NeoPixel library.
small.begin();
}
void loop() {
// For a set of Neobig the first NeoPixel is 0, second is 1, all the way up to the count of big minus one.
for(int i=0;i<NUMbig;i++){
// big.Color takes RGB values, from 0,0,0 up to 255,255,255
big.setPixelColor(i, big.Color(0,10,0)); // Moderately bright green color.
small.setPixelColor(i, big.Color(0,0,10));
big.show(); // This sends the updated small color to the hardware.
small.show();
delay(delayval); // Delay for a period of time (in milliseconds).
}
}
Here is the code I am trying to implement it
Code: Select all
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define bigPIN 11
#define smallPIN 12
#define NUMbig 48
#define NUMsmall 48
#define BRIGHTNESS 50
Adafruit_NeoPixel big = Adafruit_NeoPixel(NUMbig, bigPIN, NEO_GRBW + NEO_KHZ800);
Adafruit_NeoPixel small = Adafruit_NeoPixel(NUMsmall, smallPIN, NEO_GRB + NEO_KHZ800);
int counter = 0;
char t[10]={};
const byte SLAVE_ADDRESS = 8;
int selectPin = 3;
int lastValue1 = 0;
int arrays[128];
long encval;
bool oldState = HIGH;
int casario;
int cased;
int cases;
int pbr;
int pbg;
int pbb;
int psr;
int psg;
int psb;
int x = 0;
int createdEnc = 0;
int nowEnc = 0;
void setup() {
delay(500);
Serial.begin(9600);
Serial.println("Starting Setup");
Serial.println("Setting Up Pins");
Wire.begin(SLAVE_ADDRESS);
Serial.print("=");
pinMode(selectPin,INPUT_PULLUP);
Serial.print("=");
// pinMode(clearPin,INPUT_PULLUP);
// Serial.print("=");
// attachInterrupt(digitalPinToInterrupt(clearPin),Clear,HIGH);
Serial.println("Finished Setting Up Pins");
Serial.println("Starting Screen");
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
delay(500);
// Clear the buffer.
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(WHITE);
display.print("Starting Up");
display.display();
delay(500);
Serial.println("Finished setting up screen");
#if defined (__AVR_ATtiny85__)
if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif
// End of trinket special code
Serial.println("Starting Setting up LEDS");
// small.setBrightness(BRIGHTNESS);
// big.setBrightness(BRIGHTNESS);
big.begin();
small.begin();
big.show();
small.show();
Serial.println("Finished Setting Up LEDS");
Serial.println("Finished Setup");
// cross(255,0,0,50);
// cross(0,0,0,50);
// display.display();
// eyes();
// encRes();
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void loop(){
// selection();
// picker();
//averageRGB();
// requestEncoder();
for(int i=0;i<48;i++){
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
big.setPixelColor(i, big.Color(0,10,0)); // Moderately bright green color.
small.setPixelColor(i, small.Color(0,0,10));
big.show(); // This sends the updated pixel color to the hardware.
small.show();
delay(50);
}
}
-Eric