Single WS2812B addressable LED

I admit that I am way over my head. I have a project that I need to add a single addressable WS2812B LED to. I am using a Sparkfun "LED - RGB Addressable, PTH, 5mm Diffused". The attached schematic is the way I wired it, with 2 exceptions: i put a 1/4 watt 470ohm resistor on the data in line, and a 0.1 μF capacitor between each WS2812 LED's VDD and GND. I am powering the Uno with only the USB power. I used the attached code from Sparkfun . . . and I get nothing. The menu presents itself, requests the device to be tested, then it goes off and runs with no visible activity or lights on the LED.

Any help would be greatly appreciated. I have to think it is something simple that I just don't understand.

// Include Libraries
#include "Arduino.h"
#include "Adafruit_NeoPixel.h"


// Pin Definitions
#define LEDRGB_PIN_DIN	2



// Global variables and defines
#define LedRGB_NUMOFLEDS 1
// object initialization
Adafruit_NeoPixel LedRGB(LEDRGB_PIN_DIN);


// define vars for testing menu
const int timeout = 10000;       //define timeout of 10 sec
char menuOption = 0;
long time0;

// Setup the essentials for your circuit to work. It runs first every time your circuit is powered with electricity.
void setup() 
{
    // Setup Serial which is useful for debugging
    // Use the Serial Monitor to view printed messages
    Serial.begin(9600);
    while (!Serial) ; // wait for serial port to connect. Needed for native USB
    Serial.println("start");
    
    LedRGB.begin(); // This initializes the NeoPixel library.
    LedRGB.show(); // Initialize all leds to 'off'
    menuOption = menu();
    
}

// Main logic of your circuit. It defines the interaction between the components you selected. After setup, it runs over and over again, in an eternal loop.
void loop() 
{
    
    
    if(menuOption == '1') {
    // LED - RGB Addressable, PTH, 5mm Diffused (5 Pack) - Test Code
    for(int i=0 ; i <= LedRGB_NUMOFLEDS ; i++){
    for (int k = 0 ; k <= 255 ; k++) {
    // set leds Color to RGB values, from 0,0,0 up to 255,255,255
    LedRGB.setPixelColor(i, LedRGB.Color(255-k,k,100)); // turn on green color on led #i.
    if (i > 0)
    LedRGB.setPixelColor(i-1, LedRGB.Color(0,0,0)); // turn off last led
    LedRGB.show(); //update led color to the hardware.
    delay(1);
    }
    }

    }
    
    if (millis() - time0 > timeout)
    {
        menuOption = menu();
    }
    
}



// Menu function for selecting the components to be tested
// Follow serial monitor for instrcutions
char menu()
{

    Serial.println(F("\nWhich component would you like to test?"));
    Serial.println(F("(1) LED - RGB Addressable, PTH, 5mm Diffused (5 Pack)"));
    Serial.println(F("(menu) send anything else or press on board reset button\n"));
    while (!Serial.available());

    // Read data from serial monitor if received
    while (Serial.available()) 
    {
        char c = Serial.read();
        if (isAlphaNumeric(c)) 
        {   
            
            if(c == '1') 
    			Serial.println(F("Now Testing LED - RGB Addressable, PTH, 5mm Diffused (5 Pack)"));
            else
            {
                Serial.println(F("illegal input!"));
                return 0;
            }
            time0 = millis();
            return c;
        }
    }
}

/*******************************************************

*    Circuito.io is an automatic generator of schematics and code for off
*    the shelf hardware combinations.

*    Copyright (C) 2016 Roboplan Technologies Ltd.

*    This program is free software: you can redistribute it and/or modify
*    it under the terms of the GNU General Public License as published by
*    the Free Software Foundation, either version 3 of the License, or
*    (at your option) any later version.

*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU General Public License for more details.

*    You should have received a copy of the GNU General Public License
*    along with this program.  If not, see <http://www.gnu.org/licenses/>.

*    In addition, and without limitation, to the disclaimers of warranties 
*    stated above and in the GNU General Public License version 3 (or any 
*    later version), Roboplan Technologies Ltd. ("Roboplan") offers this 
*    program subject to the following warranty disclaimers and by using 
*    this program you acknowledge and agree to the following:
*    THIS PROGRAM IS PROVIDED ON AN "AS IS" AND "AS AVAILABLE" BASIS, AND 
*    WITHOUT WARRANTIES OF ANY KIND EITHER EXPRESS OR IMPLIED.  ROBOPLAN 
*    HEREBY DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT 
*    NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY, TITLE, FITNESS 
*    FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND THOSE ARISING BY 
*    STATUTE OR FROM A COURSE OF DEALING OR USAGE OF TRADE. 
*    YOUR RELIANCE ON, OR USE OF THIS PROGRAM IS AT YOUR SOLE RISK.
*    ROBOPLAN DOES NOT GUARANTEE THAT THE PROGRAM WILL BE FREE OF, OR NOT 
*    SUSCEPTIBLE TO, BUGS, SECURITY BREACHES, OR VIRUSES. ROBOPLAN DOES 
*    NOT WARRANT THAT YOUR USE OF THE PROGRAM, INCLUDING PURSUANT TO 
*    SCHEMATICS, INSTRUCTIONS OR RECOMMENDATIONS OF ROBOPLAN, WILL BE SAFE 
*    FOR PERSONAL USE OR FOR PRODUCTION OR COMMERCIAL USE, WILL NOT 
*    VIOLATE ANY THIRD PARTY RIGHTS, WILL PROVIDE THE INTENDED OR DESIRED
*    RESULTS, OR OPERATE AS YOU INTENDED OR AS MAY BE INDICATED BY ROBOPLAN. 
*    YOU HEREBY WAIVE, AGREE NOT TO ASSERT AGAINST, AND RELEASE ROBOPLAN, 
*    ITS LICENSORS AND AFFILIATES FROM, ANY CLAIMS IN CONNECTION WITH ANY OF 
*    THE ABOVE. 
********************************************************/

What happens when you just run a single pixel test? Do you get anything? If not, it’s your wiring, or you are selecting the wrong library.

If you followed their tutorial WS2812 Breakout Hookup Guide - learn.sparkfun.com , it should work.

They even give you example code. Hmmmmm.

Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

Problem solved. I used the code and library in the link you provided exactly. Did not work. I used the FastLED library and wrote very simple code and it worked like a charm with no wiring changes Hmmmmmmm.

ieee488:
If you followed their tutorial WS2812 Breakout Hookup Guide - learn.sparkfun.com , it should work.

They even give you example code. Hmmmmm.

I used the code and library in the link you provided exactly. Did not work. I used the FastLED library and wrote very simple code and it worked like a charm with no wiring changes Hmmmmmmm.

Contact Sparkfun through their forum, or customer service email & bring this to their attention, the code examples they supply for their products have always worked for me!

Just for completeness, could you post the code that didn't work here.

The code that did NOT work is in my initial post above.

Using the NeoPixel Library
Setup
There are a few lines of code required to set up your sketch to use the library. First, call the constructor near the top of your code (before

setup()

, you'll probably want it to be a global variable).

#define PIN 4

#define LED_COUNT 8

// Create an instance of the Adafruit_NeoPixel class called "leds".
// That'll be what we refer to from here on...
Adafruit_NeoPixel leds = Adafruit_NeoPixel(LED_COUNT, PIN, NEO_GRB + NEO_KHZ800);




The 


PIN



and 


LED_COUNT



parameters in that function call should be set, respectively, to the **Arduino pin** you've connected to the first breakout's "DIN" pin and the total **number of breakout boards** you have linked up.
The rest of the setup is calling the 


leds.begin()



function somewhere near the beginning of the 


setup()



function.

On the sparkfun hookup guide! I can only assume you did not read that page, giving you the explicit instructions, then come back and be sarcastic with

Problem solved. I used the code and library in the link you provided exactly. Did not work. I used the FastLED library and wrote very simple code and it worked like a charm with no wiring changes Hmmmmmmm.

paulshryock:
I admit that I am way over my head. I have a project that I need to add a single addressable WS2812B LED to. I am using a Sparkfun "LED - RGB Addressable, PTH, 5mm Diffused". The attached schematic is the way I wired it, with 2 exceptions: i put a 1/4 watt 470ohm resistor on the data in line, and a 0.1 μF capacitor between each WS2812 LED's VDD and GND. I am powering the Uno with only the USB power. I used the attached code from Sparkfun . . . and I get nothing. The menu presents itself, requests the device to be tested, then it goes off and runs with no visible activity or lights on the LED.

Any help would be greatly appreciated. I have to think it is something simple that I just don't understand.

// Include Libraries

#include "Arduino.h"
#include "Adafruit_NeoPixel.h"

// Pin Definitions
#define LEDRGB_PIN_DIN 2

// Global variables and defines
#define LedRGB_NUMOFLEDS 1
// object initialization
Adafruit_NeoPixel LedRGB(LEDRGB_PIN_DIN);

// define vars for testing menu
const int timeout = 10000;       //define timeout of 10 sec
char menuOption = 0;
long time0;

// Setup the essentials for your circuit to work. It runs first every time your circuit is powered with electricity.
void setup()
{
   // Setup Serial which is useful for debugging
   // Use the Serial Monitor to view printed messages
   Serial.begin(9600);
   while (!Serial) ; // wait for serial port to connect. Needed for native USB
   Serial.println("start");
   
   LedRGB.begin(); // This initializes the NeoPixel library.
   LedRGB.show(); // Initialize all leds to 'off'
   menuOption = menu();
   
}

// Main logic of your circuit. It defines the interaction between the components you selected. After setup, it runs over and over again, in an eternal loop.
void loop()
{
   
   
   if(menuOption == '1') {
   // LED - RGB Addressable, PTH, 5mm Diffused (5 Pack) - Test Code
   for(int i=0 ; i <= LedRGB_NUMOFLEDS ; i++){
   for (int k = 0 ; k <= 255 ; k++) {
   // set leds Color to RGB values, from 0,0,0 up to 255,255,255
   LedRGB.setPixelColor(i, LedRGB.Color(255-k,k,100)); // turn on green color on led #i.
   if (i > 0)
   LedRGB.setPixelColor(i-1, LedRGB.Color(0,0,0)); // turn off last led
   LedRGB.show(); //update led color to the hardware.
   delay(1);
   }
   }

}
   
   if (millis() - time0 > timeout)
   {
       menuOption = menu();
   }
   
}

// Menu function for selecting the components to be tested
// Follow serial monitor for instrcutions
char menu()
{

Serial.println(F("\nWhich component would you like to test?"));
   Serial.println(F("(1) LED - RGB Addressable, PTH, 5mm Diffused (5 Pack)"));
   Serial.println(F("(menu) send anything else or press on board reset button\n"));
   while (!Serial.available());

// Read data from serial monitor if received
   while (Serial.available())
   {
       char c = Serial.read();
       if (isAlphaNumeric(c))
       {  
           
           if(c == '1')
    Serial.println(F("Now Testing LED - RGB Addressable, PTH, 5mm Diffused (5 Pack)"));
           else
           {
               Serial.println(F("illegal input!"));
               return 0;
           }
           time0 = millis();
           return c;
       }
   }
}

/*******************************************************

  • Circuito.io is an automatic generator of schematics and code for off

  • the shelf hardware combinations.

  • Copyright (C) 2016 Roboplan Technologies Ltd.

  • This program is free software: you can redistribute it and/or modify

  • it under the terms of the GNU General Public License as published by

  • the Free Software Foundation, either version 3 of the License, or

  • (at your option) any later version.

  • This program is distributed in the hope that it will be useful,

  • but WITHOUT ANY WARRANTY; without even the implied warranty of

  • MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

  • GNU General Public License for more details.

  • You should have received a copy of the GNU General Public License

  • along with this program.  If not, see http://www.gnu.org/licenses/.

  • In addition, and without limitation, to the disclaimers of warranties

  • stated above and in the GNU General Public License version 3 (or any

  • later version), Roboplan Technologies Ltd. ("Roboplan") offers this

  • program subject to the following warranty disclaimers and by using

  • this program you acknowledge and agree to the following:

  • THIS PROGRAM IS PROVIDED ON AN "AS IS" AND "AS AVAILABLE" BASIS, AND

  • WITHOUT WARRANTIES OF ANY KIND EITHER EXPRESS OR IMPLIED.  ROBOPLAN

  • HEREBY DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT

  • NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY, TITLE, FITNESS

  • FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND THOSE ARISING BY

  • STATUTE OR FROM A COURSE OF DEALING OR USAGE OF TRADE.

  • YOUR RELIANCE ON, OR USE OF THIS PROGRAM IS AT YOUR SOLE RISK.

  • ROBOPLAN DOES NOT GUARANTEE THAT THE PROGRAM WILL BE FREE OF, OR NOT

  • SUSCEPTIBLE TO, BUGS, SECURITY BREACHES, OR VIRUSES. ROBOPLAN DOES

  • NOT WARRANT THAT YOUR USE OF THE PROGRAM, INCLUDING PURSUANT TO

  • SCHEMATICS, INSTRUCTIONS OR RECOMMENDATIONS OF ROBOPLAN, WILL BE SAFE

  • FOR PERSONAL USE OR FOR PRODUCTION OR COMMERCIAL USE, WILL NOT

  • VIOLATE ANY THIRD PARTY RIGHTS, WILL PROVIDE THE INTENDED OR DESIRED

  • RESULTS, OR OPERATE AS YOU INTENDED OR AS MAY BE INDICATED BY ROBOPLAN.

  • YOU HEREBY WAIVE, AGREE NOT TO ASSERT AGAINST, AND RELEASE ROBOPLAN,

  • ITS LICENSORS AND AFFILIATES FROM, ANY CLAIMS IN CONNECTION WITH ANY OF

  • THE ABOVE.
    ********************************************************/





![Capture.JPG|531x565](upload://z8jSYsqZO7q4wX0SoPsgdaOuLy6.jpeg)

Will this work directly: https://ledspot.ro/variator-smart-rf-1-canal-triac-montaj-in-caseta-7253 ???

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.