Go Down

Topic: Giving buttons different functions for neo pixels  (Read 217 times) previous topic - next topic

tomg1233

Dec 05, 2019, 11:20 pm Last Edit: Dec 05, 2019, 11:37 pm by tomg1233
Hi!

So basically, I'm making a college project, and i'm a bit stuck and hoping someone might be able to give me a helping hand. This should go without saying, but i'm not particularly experienced with Arduinos, so apologies.

REQUEST: I've got an array to switch the neopixel routine on demand, however I seem to only be able to use it in one instance (e.g. one button). How would I go about using other buttons to control different sets of neo pixels at the same time?

The aim of the project is a centralised 'control panel' for my desk, see photo attached. I've got quite a few outputs and inputs built in already, which are all working individually, I've just got myself in a pickle with the coding itself. The expectations I've set myself for the college project, is that, the Neo pixels surrounding the PC monitors change colour on demand (which is sorted), another set  underneath the desk to function as 'notification' (signal) LEDs. e.g. the hope was when something changes, e.g. wireless charger used, or pc turned on these pulse. A set of neopixels (spotlight) overlooking some cool crystal rocks I discovered in my loft (cash in the attic much!) which change with a button, and finally, ones situated under the USB's to pulse when a USB is put in. (see photo) along with some other aesthetics, pulsing power button when pc off etc, and a microphone for making funky patterns with the lights, but that is a question for another day.

Inputs:
Status of the PC (When its on it sends a signal to the Arduino)
Status of the Wireless Charger (When its on it sends a signal to the Arduino)
10x USB inputs. Cowboy DIY'd a solution to detecting an input - 3D printed a frame holding so when LDR illuminates from an inputted USB, an analog signal is transmitted to the Arduino
A microswitch (for when the panel is removed, to cut power from MOSFETS)
5x Buttons (6th button in photo is power directly to the PC)

Outputs:
4x NeoPixel strips
4 digit clock
4x MOSFETS

I'll admit, and probably be told, that this code is rather messy. As mentioned previously i'm rather un-experienced and this has been a steep learning curve, and as I've experimented with new things I've learned online I've thrown them in the code, so apologies if it looks like shambles to all of you experienced coders:





(code too long (hit 9k character limit) will chuck the code in the comments!)



I've made an account to ask this and I've tried to research a bit into how to ask questions properly, please correct me if I've messed it up.

Many thanks,

Tom :)

PaulRB

Welcome to the forum and +1 karma for using code tags.

About your question: Too much detail and too much code that is not relevant to the thing you want help with. Forum members won't want to wade through all that and sort out the relevant parts from the rest. You will get more help if you do that for them. Cut down the circuit and the code so it's just the minimum needed to demonstrate the relavent part you have working and need help to improve. Any inputs, components, lines of code etc that are not needed for that should be removed from the circuit until your problem is solved. Then you can work on adding those back in again afterwards.

Go Up