LED controller zones

Hello, Thanks for reading!

What I plan to do is control four "zones" of LED strip lights using an arduino mega.

The four zones will be selected using a button with an LED light.

When the zone is ON and programed, I want the light to be SOLID
when the zone is SELECTED FOR PROGRAMMING, I want the light to be FLASHING
when the zone is OFF and NOT SELECTED, I want the light to be OFF

While that is happening, I have an LCD screen that will function as a button, receiving inputs via buttons to move along a menu, so that I can choose what program to operate it, and select the program.

My question is once some presses the zone 1 for example, to make a chance to the program that is currently running, and they want to change to the zone 2 button after pressing the zone 1 button, how should I construct the loop to allow for this?

What code have you written so far (you write "the program that is currently running")? Or what example are you wondering how to modify?
Show the code, show the code....

I havnt written any code...

I got peices of the code, but it's not combined....

I'm more or less asking for general tips eg, what sort of functions to use. How to change a variable after it's been defined but also save it's value so that the LEDs in zone 1 can be driven while the pattern for zone two is being chosen

Yeah, that was what I was afraid of.

How to change a variable after it's been defined

Of course, that is really Programming and not a Project Guidance?

int a = 7 ;  // defines and gives the variable an initial value (before setup or loop runs)

inside setup(), loop() or your own functions:

  a = 13 ;  // "change a variable after it's been defined"

Now if the above was too simple, then appologies for misunderstanding your question, and carry on with the text below. If that was revealing, then you first need to understand "basic programming" way before you cut-n-paste more code pieces or "combine" them.


The problem you pose is the same whether we are talking about "zones" (whatever that was, did not understand your explanation) or just a simple LED. Likewise buttons or "LCD as a Pushbutton". I guess you are using a "standard" LCD/pushbutton unit with accompaning library.

Suggestion to you: Get your Arduino, hook up a few LEDs (each with a resistor) and a few buttons (connecting the Arduino pin to GND when pressed - set the pin to INPUT_PULLUP). Now you have an enviroment to exercise your programming skills and when that works you can wire up your Zones and LCD and all that. Create projects in small steps.

The first programming exercise should be a Push-On Push-Off functionality. (there is a minor challenge that you need to debounce the button. The simpleminded way is with delay, the correct way is with a timer. The former will work "well enough" for what you have explained, but will bite you if/when the project includes more stuff).

Thank you for your response. I understand you can change a variable with code presented.

I get the words LED and LCD mixed up for whatever reason, I meant LED.

What i'm really getting at is can you run a loop to send signals to an LED strip while at the same time selecting which program to send to a second group of LED's (two zones).

I've done the steps you've listed already, with success, but have no idea where to start as far as seperating them into zones. Also, i'm waiting for parts (buttons) to arrive :-/

You can use two wires to simulate a button. Join them - button pushed. Seperate them - button un-pushed. 8)

can you run a loop to send signals to an LED strip while at the same time selecting which program

Yes of course you can do that. There is almost no limit what you can do with the software logic as long as the timing is not too critical or short. Anything that involve blinking lights, buttons pushed by humans is dooable. Look at the avreage 3D printer. It reads an SD card with instructions, pulses the steppers, monitors the temperature, end stop switches and if not using a SD, monitors the ASCII input for the next command. (Yes, I wrote such a program from scratch.)

Somewhere in here i worte a similar example some time ago. (damn the limited search facility). This item is not what I am thinkimg of, but it might help you see the way forward.