THIS CODE DOES NOT WORK
Code: Select all
//Mandatory items to make NEOPIXELS function
#include <Adafruit_NeoPixel.h>
const int ledNum = 9; // Number of LED's
const int ledPin = 0; // ATtiny85 LED signal output pin #
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(ledNum, ledPin);
//add ons
uint32_t Blue = pixels.Color(0, 0, 255);
void setup() {
pixels.begin();
pixels.show();
pinMode(ledPin, OUTPUT);
}
// Set each pixel brightness individually
void setPixelColor( uint16_t n, uint8_t r, uint8_t g, uint8_t b, uint16_t brightness) {
pixels.setPixelColor(n, (brightness*r/255) , (brightness*g/255), (brightness*b/255));
}
void setPixelColor (uint16_t n, uint32_t c, uint16_t brightness);
void loop()
{
pixels.setPixelColor(1, Blue, 250);
pixels.show();
delay(1000);
pixels.setPixelColor(1, Blue, 125);
pixels.show();
delay(1000);
}
THIS CODE WORKS
Code: Select all
//Mandatory items to make NEOPIXELS function
#include <Adafruit_NeoPixel.h>
const int ledNum = 9; // Number of LED's
const int ledPin = 0; // ATtiny85 LED signal output pin #
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(ledNum, ledPin);
//add ons
uint32_t Blue = pixels.Color(0, 0, 255);
void setup() {
pixels.begin();
pixels.show();
pinMode(ledPin, OUTPUT);
}
// Set each pixel brightness individually using uint32_t
void setPixelColor( uint16_t n, uint8_t r, uint8_t g, uint8_t b, uint16_t brightness) {
pixels.setPixelColor(n, (brightness*r/255) , (brightness*g/255), (brightness*b/255));
}
void setPixelColor (uint16_t n, uint32_t c, uint16_t brightness){
}
void loop()
{
pixels.setPixelColor(1, 0,0,255, 250);
pixels.show();
delay(1000);
pixels.setPixelColor(1, 0,0,255, 125);
pixels.show();
delay(1000);
}