Hi, I can't find something for one LED (only stripe, and doesn't work), I would like to drive one WS2812 with RGB rainbow effect, ther eis any function ready for this? I would avoid to write for cycles and select manually colors.
Simply a function with number of colors (palette) and delay before switch to next. Thank you
Just use a library like FastLed or the Adafruit NeoPixel library, and specify "1" for the number of pixels.
For the effect, just look at the Rainbow sketches for multiple LEDs, one might just work instantly with one pixel, or with slight modifications only.
If stripe code doesn't work, you need to find out the reason before you move on to addressing one pixel.
thanks for reply, I've tried to find out, I can't find a valid example. Also, there are many for cycles for different LEDs, I have only one! There is any simple function like:
for(j=0; i<255); i++) {
setPixelColor(0, j);
}
Any rainbow example can be used. The number of specified LEDs can be infinitely more than the actual number - the ICs are in a daisy chain, they are driven in the order of connection and unused LEDs are just ignored.
I'm pretty sure FastLed must have a rainbow example. It's almost a stereotypical demo.
However, you can definitely write your own, along the lines of what you posted. Why not? Do some learning about the library functions from the library you are using and have fun.. look at the example sketches that come with the library.
FastLED examples in Wokwi simulation: https://wokwi.com/arduino/libraries/FastLED
You can start the simulation in your browser, you don't even have to log in.
FastLED and Neopixel demonstrations: https://www.tweaking4all.com/hardware/arduino/adruino-led-strip-effects/
It is always nice to watch Andreas Spiess his opinion on a subject: 432 Tips and Tricks for Neopixels Projects (Arduino, ESP8266/ ESP32) - YouTube
To help with your project, can you tell more ? We like to know everything. A common problem is not enough power for the ledstrip, or not enough SRAM in a Arduino Uno, or not enough voltage for the signal with a ESP32, or a ledstrip that needs a different signal, and so on. We probably have also seen your problem here on this forum.
Thanks for replies,
I have no problems, I'm just trying to find a very short code to reproduce all the rainbow colours on one sigle pixel. I'll look the link you sent me, thanks
If it is so complicated, I'll do that with the for cycles :((
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.