Multiple input for LEDS


#1

Hello,
I am building a lamp for my daughter, I have a pot with fade to create a dim-able lamp, then a button that create smooth flashing lights, but I can’t figure how to create a button that would dim my sin-wave cycle smootly from 1 to 0 in let’s say 30 min.

If you anybody could help me I deeply appreciate.
cheers


#2

Hello and WoW! Cool lamp :+1:

I’m not sure what you’re asking for? Are you talking about changing the amplitude smoothly? If so, I would suggest to pass OUT of sine-wave to multiply as the first factor. Then use your button + flip-flop output as the second factor.

The output of the multiply can be used as the LUM for a led.


#3

hey! thanks for your quick reply!
so what I want to do is
no button pushed pot is dimming the light, no blinking lights
button A pushed blinking light with the sin wave / push again button A pot is the LED brightness source
button B pushed it become a timer, 30 min of blinking lights fading away / push again button B pot is the LED brightness source

I solved the no button pushed and pot, and the button A pushed.
unfortunately I am really bad in logics could you do me a drawing of what you said? I am quite a visual guy…

and can I have more than one input into a LED? I can only see the if else as a “gate” for multiple entries.
(I know gate is not the right word but a thingy that can allow me to have different input that can selected by a button to be an output)
Sorry for being so blur
cheers
laurent


#4

Something like:

No, in XOD paradigm an input can’t link to multiple outputs as there will be no single source of truth. So, using if-else’s is OK. There are techniques for switching data sources literally with the xod/core/gate nodes, but they are clunky a bit and not well described for now. We are working on improvements.


#5

I think he only has one LED. I came up with this:

Which uses the fading_blink module I also created:

None of which I have actually tested… you get what you pay for :slight_smile:

Main is just remembering which buttons were pushed & selecting appropriate input for LED (pot, sine wave, or fading blink).

fading_blink seems more complicated than it needs to be. If FADE is false, it quickly moves the fade output to 1; else it starts the 30 min count-down to 0 and multiples that output with square-wave output to get a blink that slowly fades the on value over the 30 minutes. (Note that LED will probably quit lighting long before blink value gets to 0…I didn’t try to account for that)


#6

awesome! thanks a lot


#7

awesome! thanks a lot! I will try that today


#8

hey, quick question about, the 1/1800. is it a divide (XOD/core/Divide)? your solution is working quite nicely, well except it doesn’t fade, but the blinking is quite nice. But I am pretty that’s because I messed somewhere. (the joy of learning new things, mistakes are often more interesting…)
Cheers,
laurent


#9

I used divide only because constant was not wide enough to show the decimal value. With this value to fade over 1/2 hour, you will need to let it run for 10 minutes or so to notice much change.

Bah… looking at code again, looks like I swapped condition… Getting rid of not in main should help


#10

Ok. trying that. Thanks for your help!


#11

it works perfectly!
Do you have an Instagram account so i can credit you in my post?
(I don’t have many followers but it’s part of my ethic)


#12

I do not have an instagram account. I’m just gweimer in the XOD forum :slight_smile: