I have 3 Neopixel LED rings that have 12, 16, and 24 LEDs and I am using Arduino for programming. I am using Serial Communication, the user selects the LEDs and the colors.
The requirements were:
- 1) I should be able to control all the LEDs separately.
- 2) I should be able to send different colors to any LED and they should stay in that state until I shut it down. For ex. I want first: red on the 1st LED on the 1st ring and then yellow on the second LED and then pink on the 3rd LED on the 3rd ring. My first problem was, figuring out how to light up the LEDs in any order at the same time. The one that was first selected; and then not selected: It was changing its color when I select another one with another color. But It should have remembered its state and should not change when I was selecting the other LED with another color.
Code: Select all
if (updateRing1Led[1]) {
EEPROM.update(given R and G and B) } ---> update the color
else{
EEPROM.read(given R and G and B)} ---> Ring1Led1 is not selected; do not update; just read the color.
//Update the color in the selected LED.
//Do not update if the LED is not selected; just keep stay in the last color until selected.
if (the input is 1)
updateRing1Led[1] == true;
updateRing1Led[2] == false;
if(the input is 2)
updateRing1Led[2] = true;
updateRing1Led[1] = false;
But; I got comments like this can be the best way to kill the EEPROM since I'm using these updates in the draw() section; because it should change according to the user input. But this was literally the only algorithm I could come up with for these requirements. So I have 2 questions:
- 1 ) Is there a way to meet these requirements without using EEPROM? Maybe there is some functions I don't know about these rings.
- 2) A noobie question but...What do you think, like how dangerous is this method, could it stop working in the middle of the project someday? And could it make the Arduino useless at any time?
- 3) If I use Arduino Nano or Micro, would that be very problematic with this algorithm?