Greetings everyone!
I have been having a blast with NeoPixels and I have been using AdaFruit’s NeoPixel Library. It has some limitations but it works ok. I have been trying to get the FastLED Library working but to no avail. I am using ATTiny85s for my project for nothing but size. I love the features of FastLED but I think I need a little help. I know the ATTinys running at 8MHz do very well with the NeoPixels using the same library. What I want to do is switch over to using it instead but I am not having any success. Basically the LEDs will not light. If I do the same thing using the NeoPixel library, it works! I am just trying to use the RGBCalibrate sketch to get things going.
Any help will be greatly appreciated!
Thanks in advance!
Here is my sketch using FastLED:
#include “FastLED.h”
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// RGB Calibration code
//
// Use this sketch to determine what the RGB ordering for your chipset should be. Steps for setting up to use:
// * Uncomment the line in setup that corresponds to the LED chipset that you are using. (Note that they
// all explicitly specify the RGB order as RGB)
// * Define DATA_PIN to the pin that data is connected to.
// * (Optional) if using software SPI for chipsets that are SPI based, define CLOCK_PIN to the clock pin
// * Compile/upload/run the sketch
// You should see six leds on. If the RGB ordering is correct, you should see 1 red led, 2 green
// leds, and 3 blue leds. If you see different colors, the count of each color tells you what the
// position for that color in the rgb orering should be. So, for example, if you see 1 Blue, and 2
// Red, and 3 Green leds then the rgb ordering should be BRG (Blue, Red, Green).
// You can then test this ordering by setting the RGB ordering in the addLeds line below to the new ordering
// and it should come out correctly, 1 red, 2 green, and 3 blue.
//
//////////////////////////////////////////////////
#define NUM_LEDS 6
// Data pin that led data will be written out over
#define DATA_PIN 0 // This is NOT the reset pin but PB0 which is physical pin 5 on the chip PDIP/SSOP
// Clock pin only needed for SPI based chipsets when not using hardware SPI
//#define CLOCK_PIN 8
CRGB leds[NUM_LEDS];
void setup() {
// sanity check delay - allows reprogramming if accidently blowing power w/leds
delay(2000);
FastLED.addLeds<NEOPIXEL, DATA_PIN, RGB>(leds, NUM_LEDS);
// Uncomment one of the following lines for your leds arrangement.
// FastLED.addLeds<TM1803, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<TM1804, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<TM1809, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<WS2801, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<SM16716, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<LPD8806, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<SM16716, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
// FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
}
void loop() {
leds[0] = CRGB::Red;
leds[1] = CRGB::Green;
leds[2] = CRGB::Green;
leds[3] = CRGB::Blue;
leds[4] = CRGB::Blue;
leds[5] = CRGB::Blue;
FastLED.show();
delay(1000);
}
And here is the equivalent sketch using the NeoPixel library:
#include <Adafruit_NeoPixel.h>
#define DATAPIN 0
#define NUM_LEDS 6
// 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)
Adafruit_NeoPixel rings = Adafruit_NeoPixel(NUM_LEDS, DATAPIN, 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() {
delay(2000);
rings.begin();
rings.show(); // Initialize all pixels to ‘off’
}
void loop() {
rings.setPixelColor(0, 0xFF0000);
rings.setPixelColor(1, 0x00FF00);
rings.setPixelColor(2, 0x00FF00);
rings.setPixelColor(3, 0x0000FF);
rings.setPixelColor(4, 0x0000FF);
rings.setPixelColor(5, 0x0000FF);
rings.show();
delay(1000);
}