Ok, so heres the deal, i have two working sketches, one for each pin on my Trinket.
the first sketch is meant to control two stands of 5 leds wired into pin 1 (easy right).
it looks like this.........
#include <Adafruit_NeoPixel.h>
#ifdef AVR
#include <avr/power.h>
#endif
#define PIN 1
// Parameter 1 = 5
// 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_GRB + NEO_KHZ800);
// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
// pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
// and minimize distance between Arduino and first pixel. Avoid connecting
// on a live circuit...if you must, connect GND first.
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
strip.begin();
strip.setBrightness(50);
strip.show(); // Initialize all pixels to 'off'
}
void loop() {
// Some example procedures showing how to display to the pixels:
colorWipe(strip.Color(255, 0, 0), 80); // Red
colorWipe(strip.Color(0, 0, 0), 0); // Green
colorWipe(strip.Color(0, 0, 0), 0); // Blue
//colorWipe(strip.Color(0, 0, 0, 255), 50); // White RGBW
// Send a theater pixel chase in...
}
// Fill the dots one after the other with a color
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);
}
}
The second sketch controls one strip of 5 leds, wired into pin 2 (also easy)
and it looks like this.....
// 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 NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1
#define PIN 2
// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 5
// When we setup the NeoPixel library, we tell it how many pixels, 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 pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
int delayval = 0; // 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
pixels.begin(); // This initializes the NeoPixel library.
}
void loop() {
// For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.
for(int i=0;i<NUMPIXELS;i++){
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
pixels.setPixelColor(i, pixels.Color(0,0,255)); // bright blue color.
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
pixels.setPixelColor(1, pixels.Color(255,0,0)); // bright red color.
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
pixels.setPixelColor(2, pixels.Color(0,0,0)); // no color.
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
pixels.setPixelColor(3, pixels.Color(255,0,0)); // bright red color.
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
pixels.setPixelColor(4, pixels.Color(0,0,255)); // bright blue color.
pixels.show(); // This sends the updated pixel color to the hardware.
delay(delayval); // Delay for a period of time (in milliseconds).
}
}
but when i try to combine them like this.....
#include <Adafruit_NeoPixel.h>
#ifdef AVR
#include <avr/power.h>
#endif
#define PIN 1
// Parameter 1 = 5
// 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_GRB + NEO_KHZ800);
// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
// pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
// and minimize distance between Arduino and first pixel. Avoid connecting
// on a live circuit...if you must, connect GND first.
// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1
#define PIN 2
// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS 5
// When we setup the NeoPixel library, we tell it how many pixels, 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 pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
int delayval = 0; // 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
strip.begin();
strip.setBrightness(50);
strip.show(); // Initialize all pixels to 'off'
pixels.begin(); // This initializes the NeoPixel library.
}
void loop() {
// Some example procedures showing how to display to the pixels:
colorWipe(strip.Color(255, 0, 0), 80); // Red
colorWipe(strip.Color(0, 0, 0), 0); // Green
colorWipe(strip.Color(0, 0, 0), 0); // Blue
//colorWipe(strip.Color(0, 0, 0, 255), 50); // White RGBW
// Send a theater pixel chase in...
}
// Fill the dots one after the other with a color
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);
}
}
for(int i=0;i<NUMPIXELS;i++){
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
pixels.setPixelColor(i, pixels.Color(0,0,255)); // bright blue color.
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
pixels.setPixelColor(1, pixels.Color(255,0,0)); // bright red color.
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
pixels.setPixelColor(2, pixels.Color(0,0,0)); // no color.
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
pixels.setPixelColor(3, pixels.Color(255,0,0)); // bright red color.
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
pixels.setPixelColor(4, pixels.Color(0,0,255)); // bright blue color.
pixels.show(); // This sends the updated pixel color to the hardware.
delay(delayval); // Delay for a period of time (in milliseconds).
I get this error after verifying.......
lawgivermark5:69:1: error: expected unqualified-id before 'for'
for(int i=0;i<NUMPIXELS;i++){
^
lawgivermark5:69:13: error: 'i' does not name a type
for(int i=0;i<NUMPIXELS;i++){
^
lawgivermark5:69:25: error: 'i' does not name a type
for(int i=0;i<NUMPIXELS;i++){
^
exit status 1
expected unqualified-id before 'for'
Its safe to assume i'm an idiot, for not being able to make work, what seems to be childs play to others.
if anyone could help it would be super appreciated. (just remember, this is all new to me and have no coding background, i'm trying to learn)