HAHAHA yup. Why not make it simple.Reading and understanding data sheets is a steep learning curve. Many of us have put beanies and weenies on a table for over 40 years. This is all new to a hobby enthusiast or even those starting a career. Rome wasn't built in a day.
Ron
Because it is not simple.HAHAHA yup. Why not make it simple.
Max voltage/amps, gate opening voltage.
Sorted lol.
Appreciated Ron. Guess was being very naïve. Sort of go the idea the basic blink fade example, as well as added few more LEDs. But this WS2B just total mind blowing. Spent time just going through fastled examples, altering numbers see if get colours wanting, and pattern. Just nightmare...When you have questions just ask.
Ron
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 7
// The overall fire brightness
// (this can affect both color levels and power consumption)
int brightness = 255;
// 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 strip = Adafruit_NeoPixel(29, 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.
// For the ultimate NeoPixel guide, check out:
// [URL]https://learn.adafruit.com/adafruit-neopixel-uberguide/overview[/URL]
void setup() {
strip.begin();
strip.setBrightness(brightness);
strip.show(); // Initialize all pixels to 'off'
}
void loop() {
// Uncomment one of these RGB (Red, Green, Blue) values to
// set the base color of the flame. The color will flickr
// based on the initial base color
// Regular (orange) flame:
int r = 226, g = 1, b = 0;
// Purple flame:
// int r = 158, g = 8, b = 148;
// Green flame:
//int r = 74, g = 150, b = 12;
// Flicker, based on our initial RGB values
for(int i=0; i<strip.numPixels(); i++) {
int flicker = random(12,55);
int r1 = r-flicker;
int g1 = g-flicker;
int b1 = b-flicker;
if(g1<0) g1=0;
if(r1<0) r1=0;
if(b1<0) b1=0;
strip.setPixelColor(i,r1,g1, b1);
}
strip.show();
// Adjust the delay here, if you'd like. Right now, it randomizes the
// color switch delay to give a sense of realism
delay(random(5,13));
}
This is whats wanting but with flicker. Don like sound of last could burn out strip..Hi.
Ok found this and got the colour (red) wanted.
But tried altering the flicker numbers, not getting much. This is the type of thig lookingat, also with more orange?
Thanks
C:#include <Adafruit_NeoPixel.h> #ifdef __AVR__ #include <avr/power.h> #endif #define PIN 7 // The overall fire brightness // (this can affect both color levels and power consumption) int brightness = 255; // 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 strip = Adafruit_NeoPixel(29, 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. // For the ultimate NeoPixel guide, check out: // [URL]https://learn.adafruit.com/adafruit-neopixel-uberguide/overview[/URL] void setup() { strip.begin(); strip.setBrightness(brightness); strip.show(); // Initialize all pixels to 'off' } void loop() { // Uncomment one of these RGB (Red, Green, Blue) values to // set the base color of the flame. The color will flickr // based on the initial base color // Regular (orange) flame: int r = 226, g = 1, b = 0; // Purple flame: // int r = 158, g = 8, b = 148; // Green flame: //int r = 74, g = 150, b = 12; // Flicker, based on our initial RGB values for(int i=0; i<strip.numPixels(); i++) { int flicker = random(12,55); int r1 = r-flicker; int g1 = g-flicker; int b1 = b-flicker; if(g1<0) g1=0; if(r1<0) r1=0; if(b1<0) b1=0; strip.setPixelColor(i,r1,g1, b1); } strip.show(); // Adjust the delay here, if you'd like. Right now, it randomizes the // color switch delay to give a sense of realism delay(random(5,13)); }
#include "FastLED.h"
#define NUM_LEDS 40 // # of LEDS in the strip
CRGB leds[NUM_LEDS];
#define PIN 7 // Output Pin to Data Line on Strip
#define COLOR_ORDER GRB // I had to change this for my strip if your color is off then you know.
int fadeAmount = 5; // Set the amount to fade I usually do 5, 10, 15, 20, 25 etc even up to 255.
int brightness = 0;
void setup()
{
FastLED.addLeds<WS2812B, PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
}
void loop()
{
for(int i = 0; i < NUM_LEDS; i++ )
{
leds[I].setRGB(255,30,0); // Set Color HERE!!!
leds[I].fadeLightBy(brightness);
}
FastLED.show();
brightness = brightness + fadeAmount;
// reverse the direction of the fading at the ends of the fade:
if(brightness == 0 || brightness == 255)
{
fadeAmount = -fadeAmount ;
}
delay(89);
}
int led1 = 9; // the PWM pins the LED is attached to
int led2 = 10;
int led3 = 11;
int brightness1 = 0; // how bright the LED is
int brightness2 = 0; // how bright the LED is
int brightness3 = 0; // how bright the LED is
int fadeAmount = 3; // how many points to fade the LED by
// the setup routine runs once when you press reset:
void setup() {
// declare pin 9, 10, and 11 to be an output:
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
// set the brightness of pin 7, 8, and 9:
analogWrite(led1, brightness1);
analogWrite(led2, brightness2);
analogWrite(led3, brightness3);
// change the brightness for next time through the loop:
brightness1 = brightness1 + fadeAmount;
brightness2 = brightness2 + fadeAmount;
brightness3 = brightness3 + fadeAmount;
// reverse the direction of the fading at the ends of the fade:
if (brightness1 <= 0 || brightness1 >= 255) {
fadeAmount = -fadeAmount;
if (brightness2 <= 0 || brightness2 >= 255) {
fadeAmount = -fadeAmount;
if (brightness3 <= 0 || brightness3 >= 255) {
fadeAmount = -fadeAmount;
}
Sorry djsfantasi.@Brinamo
Please learn how to post code in between code tags. The ellipsis icon has an option to insert code tags. Which formats your post for easy reading and leaves the cursor between the tags, making it easy for you to paste your code.
View attachment 253167
Code tags look like this:
View attachment 253168
Much appreciated trying to help Ron, thank you.The WS2812 is one I have never used but I did look at a code sample here on this page. Nice thing is the WS 2812 and other NeoPixel schemes are one wire programmable. I am sure by now you are familiar with the 0 through 255 scheme. If by now you haven't done so do a Google of "color picker". Remember you want a RGB scheme to get the numbers you want.
The following was originally written for a RGB LED using 3 wires but you may find a similiarity:
Not sure how this may help with a one wire LED controlCode:int led1 = 9; // the PWM pins the LED is attached to int led2 = 10; int led3 = 11; int brightness1 = 0; // how bright the LED is int brightness2 = 0; // how bright the LED is int brightness3 = 0; // how bright the LED is int fadeAmount = 3; // how many points to fade the LED by // the setup routine runs once when you press reset: void setup() { // declare pin 9, 10, and 11 to be an output: pinMode(led1, OUTPUT); pinMode(led2, OUTPUT); pinMode(led3, OUTPUT); } // the loop routine runs over and over again forever: void loop() { // set the brightness of pin 7, 8, and 9: analogWrite(led1, brightness1); analogWrite(led2, brightness2); analogWrite(led3, brightness3); // change the brightness for next time through the loop: brightness1 = brightness1 + fadeAmount; brightness2 = brightness2 + fadeAmount; brightness3 = brightness3 + fadeAmount; // reverse the direction of the fading at the ends of the fade: if (brightness1 <= 0 || brightness1 >= 255) { fadeAmount = -fadeAmount; if (brightness2 <= 0 || brightness2 >= 255) { fadeAmount = -fadeAmount; if (brightness3 <= 0 || brightness3 >= 255) { fadeAmount = -fadeAmount; }
Ron
No worries! Just trying to help.Sorry djsfantasi.
#include <FastLED.h>
#define NUM_LEDS
#define LED_PIN 7
#define CLOCK_PIN 11
#define BRIGHTNESS 255
//===============================================================
CRGB leds[NUM_LEDS];
void setup() {
// put your setup code here, to run once:
FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
FastLED.setMaxPowerInVoltsAndMilliamps(5, 800);
FastLED.setBrightness(BRIGHTNESS);
FastLED.clear();
FastLED.show();
}
void loop() {
leds[0] = CHSV( random8(255,15), random8(255,255), random8(255,255));
FastLED.show();
Alls good, finally after days hunting, found a sketch, ok flicker and colours we not right, but changed them. Easy enough to change, led count, colours, and flicker amount. PerfectFound this, messed with numbers, but only 1 led works. orig 1 light flicker youtube.
Total lost, tried adding, from 8-40 leds, but just the 1. thanks
flicker:#include <FastLED.h> #define NUM_LEDS #define LED_PIN 7 #define CLOCK_PIN 11 #define BRIGHTNESS 255 //=============================================================== CRGB leds[NUM_LEDS]; void setup() { // put your setup code here, to run once: FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS); FastLED.setMaxPowerInVoltsAndMilliamps(5, 800); FastLED.setBrightness(BRIGHTNESS); FastLED.clear(); FastLED.show(); } void loop() { leds[0] = CHSV( random8(255,15), random8(255,255), random8(255,255)); FastLED.show();
/*
*/
#include <Adafruit_NeoPixel.h>
#define PIN 7
Adafruit_NeoPixel strip = Adafruit_NeoPixel(44, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
strip.begin();
strip.show(); // Initialize all pixels to 'off'
Serial.begin(9600);
randomSeed(analogRead(100));
for (int i=0;i<=strip.numPixels();i++){
strip.setPixelColor(i, strip.Color(255, 0, 0));
}
}
void loop() {
int i=random(1,strip.numPixels());
int c=random(1,7);
if (c==0){
strip.setPixelColor(i, strip.Color(255,5,0));
}
else if (c==1){
strip.setPixelColor(i, strip.Color(255,0,0));
} else {
strip.setPixelColor(i, strip.Color(15,0,0));
}
//Serial.println(c);
strip.show();
delay(random(5,22));
}
by Aaron Carman
by Jake Hertz
by Jake Hertz
by Jake Hertz