I'm trying to build a scoreboard using an Arduino Uno board and the WS2812B LED strip.
The codes I find in the examples and on the internet make it possible to control only 1 LED at a time.
I would like to know if I can control the LED in parts to form the numbers.
There will be 2 Arduinos each controlling one side of the scoreboard
sure. you need to define ranges of leds to turn on or off to form a number
the way you do this depends on how the two digits are wired together
not sure you need two...
Welcome to the forum
If you look at the FastLED library you will see plenty of examples that control more than 1 LED at a time
FastLED also supports the concept of zones within an LED strip. This allows you to control all of the LEDs in a zone at the same time. LEDs could be allocated to zones representing each of the 7 segments of each digit
here is a basic concept with the Adafruit_NeoPixel library
you could achieve the same with fastLed
I did not fine tune to look, it's hacked together quickly with 1 digit and treat the segments just as one. You can do much better by fine tuning what's on or off, so this is just to give you an idea
click to see the code
#include <Adafruit_NeoPixel.h>
const byte pin = 5;
const size_t numLeds = 7 * 6;
Adafruit_NeoPixel strip(numLeds, pin, NEO_GRB + NEO_KHZ800);
void segF() {strip.fill(0xFF0000, 0, 6);}
void segA() {strip.fill(0xFF0000, 6, 6);}
void segB() {strip.fill(0xFF0000, 12, 6);}
void segG() {strip.fill(0xFF0000, 18, 6);}
void segE() {strip.fill(0xFF0000, 24, 6);}
void segD() {strip.fill(0xFF0000, 30, 6);}
void segC() {strip.fill(0xFF0000, 36, 6);}
void one() {strip.clear(); segB(); segC();}
void two() {strip.clear(); segA(); segB(); segG(); segE(); segD();}
void three() {strip.clear(); segA(); segB(); segG(); segC(); segD();}
void four() {strip.clear(); segF(); segG(); segC();}
void setup() {
strip.begin();
Serial.begin(115200);
}
void loop() {
one(); strip.show();
delay(1000);
two(); strip.show();
delay(1000);
three(); strip.show();
delay(1000);
four(); strip.show();
delay(1000);
}
Splitting the task amount multiple Arduino's is often way more trouble that it is worth. Unless you intend to operate each side of the scoreboard totally independently, reliable communications between the boards can be challenging.
exactly would be controlled each side separately
in my opinion it can be even done with one Arduino.
Here I have a library to use for WS2812 LEDs
https://werner.rothschopf.net/202005_arduino_neopixel_display_en.htm
Each segment has 6 LEDs. I'm in doubt about the programming to be able to create a way to increase the tens of units separately. Here is an image of the ribbon binding sequence.
I would also like to add 2 buttons, one to increase the score and another to decrease it.
It would be much simpler if you are consistent in the wiring in each digit.
I created, for my brother, a similar display a couple of years ago. It has 3 pixels (versus your 6) per segment, 7 segments and 4 digits and 1 decimal point. Each digit and the decimal points are controlled with one pin of 1 Uno (stand alone 328). It also has Bluetooth control and a hall effect switch as the display was made to count. He has been using it and is happy with how it works.
Here is the schematic.
The code has several tabs do not easy to post. I have it in a zip file. If you want me to I can send in a PM if you think it would be of use. The way that I wrote the code changing to 6 pixels instead of 3 is just a matter of changing one constant.
This simulation is "just like" your project, where I use segments and make the image "count" in different functions (sorry, it does not have magic/invisible wires). I prototyped it on cardboard . The neopixels are very good in right-angles and exact lengths... so make your project fit the neopixel, not the other way.
Pixel counts... imagined (162) versus real (below = 49)
Note: without connecting wires. Tip: make connecting wires long enough to tuck-under. Short wires (<2cm) increase stripping and soldering difficulty.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.