Hello,
im new on the forum and not so confirm with arduinio like a real coder. I make something like small project only for hobby.
Now for our kitchen i want to create a touchsensor-control RGB-LED-Stripe. And i want to use normaly 5050 LEDs and not some digital ones. I drive each color with a mosfet and pwm and want to control brightness, color and on/off functions with buttons - no bluetooth and also no remote with a app or something like this. I want to have buttons hard install on the wall to control the LED-Stripe.
I have looked around on the web and find some projects with RGB-Crossfader - most of them only for remote or bluetooth. Many of them use a loop to count the steps for the colors. I play around with it sinse 2 days and have functional brighness and on/off - but with the fading im blind or dont see the tress because of the forest...
In Detail
Working so far thes two functions:
I have one button for on/off is a momentary switch and one touch is on and another touch is off the LEDs.
Next i have two buttons also momentary switch with one is pressed brighness go down and the other button is pressed brighness go up.
Not working function:
I have another two buttons - one for fade (crossfade) from actually color to next in the rgb or hsv model and another buttons for fade from actually color backwards.
Like the brighness-function but with colors. If you want a nice smooth color and you dont know which - then you fade forward by pressing one button and if you find your color you can stop or go backwards in fading. Hope is clear what simple function i mean...?
For me is these the simplest function like a color wheel from a remote but with two buttons. I think after you have found your color i will count a timer and after a time x i will save the actually color into the eeprom so if i have power off and later on like the power switch in the kitchen on the wall the i have the same color as before and if i press the color control buttons it beginns to fade from these color.
So for this after power one i have to read the eeprom and use this color as startcolor for fading forward and backward. If is not any color in the eeprom i will set in settings first a specific color. The eeprom routine is not the problem i have use this often and on the actually project not implemented yet - is for later if all the function work correctly - for now is only for you to understand what i want to do.
So if you go into your kitchen - you switch on the Lights and your color is on the LEDs - if you want to change it you have little touchsensors behind glas to controll color, brighness, on/off the LEDs.
So simple but for an newbie complicated - i have found a project to build on my idea - is with an remote but i have deactivate it in the code.
My problem is now how i fade with pressing a button forward and also backward. I have the color-fading loop and i think i have to store the actually color first and by pressing button to set the color in the fading loop and fade from there in one direction. I think i need also two different loops - one for forward fading and one for backward fading.
If you have some ideas to modify my actually project the please tell me i will do my best... ![]()
Do you think the best idea is first to build two different loops for forward and backward or use one loop and depending from the button add or subtract the counts for the led-colors R, G and B?
Whats the best algorithm for these idea?
- Read actually color from EEprom > if not then set xR, xG, and xB and write in color (Only one time of the program - later is some color in eeprom all the time)
- Write actually color read from EEprom into the color-variables.
- Check buttons pressed
- Check which button is pressed
5a. Forward fading Button pressed - start from actually color fading forward "add" counts of the crossfader
5b. Backward fading Button pressed - start from actually color fading backward "substract" counts of the crossfader - Check released button
- Stop Fading Loop
- After time x (round about 1 minute) and no button is pressed after last button-pressed event store actually color in EEprom (Only one time after the color is changed, not every time x - because the EEprom can not have unlimited write-operations)
What do you think about it?
Regards,
Boris