more notes for a bad memory - - -
Testing a WS2812 8 LED bar display
Objective
Use for simple LED uses for Arduino - no flashing rainbow modes etc
connect 8 3 colour LEDs on one data pin !!!
First test - make a bar display of a voltage value - could be used for sound level monitor etc
Method
Use Adafruit_NeoPixel.h (thanks!)
code backup
These 3 colour LEDS are blinding bright on full brightness - - - strip.Color(256, 256, 256)
The 8 LED version tested here can use the Arduino 5 V output - any more LEDs would need external power
Circuit
The data line of the bar goes to D8 via 470 ohms in this test - 470 mfd across power supply (Adafruit advises 1000mfd)
A 10 Kohm potentiometer connects across 5 V
- center wiper to A0 analog input
A bar of LEDs lights up with number and colour depending on the input voltage
#include <Adafruit_NeoPixel.h> #define PIN 8 Adafruit_NeoPixel strip = Adafruit_NeoPixel(8, PIN, NEO_GRB + NEO_KHZ800); void setup() { strip.show(); // Initialize all pixels to 'off' Serial.begin(9600); void loop() { int sensorValue = analogRead(A0); } // function to create bar of LEDs depending on voltage on A0 // note - 8 steps as gaps between these numbers - 0 113 227 340 454 568 682 796 911 1024 |
Please email me if you want to swap notes
more to come . . .