# Multiple input for LEDS

**URL:** <https://forum.xod.io/t/multiple-input-for-leds/835>\
**Category:** Uncategorized\
**Created:** [June 8, 2018, 5:53am UTC](https://forum.xod.io/t/multiple-input-for-leds/835 "2018-06-08T05:53:24Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![laupasto15](https://avatars.discourse-cdn.com/v4/letter/l/e9bcb4/32.png) [@laupasto15](https://forum.xod.io/u/laupasto15)\
**Post date:** [June 8, 2018, 5:53am UTC](https://forum.xod.io/t/multiple-input-for-leds/835/1 "2018-06-08T05:53:24Z")

</div>

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.

> **[Laurent Pastorelli](https://www.instagram.com/p/BjbwYBVn5Br/)**

 ![22%20PM](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/93cdd78f0d959f1428c4e36b6f3b34569abfc8d4.png)

If you anybody could help me I deeply appreciate.  
cheers

---

<div class="post-metadata">

**Author:** ![nkrkv](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/nkrkv/32/8_2.png) [@nkrkv](https://forum.xod.io/u/nkrkv)\
**Post date:** [June 8, 2018, 3:11pm UTC](https://forum.xod.io/t/multiple-input-for-leds/835/2 "2018-06-08T15:11:06Z")

</div>

Hello and WoW! Cool lamp 👍

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`.

---

<div class="post-metadata">

**Author:** ![laupasto15](https://avatars.discourse-cdn.com/v4/letter/l/e9bcb4/32.png) [@laupasto15](https://forum.xod.io/u/laupasto15)\
**Post date:** [June 8, 2018, 3:34pm UTC](https://forum.xod.io/t/multiple-input-for-leds/835/3 "2018-06-08T15:34:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nkrkv](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/nkrkv/32/8_2.png) [@nkrkv](https://forum.xod.io/u/nkrkv)\
**Post date:** [June 8, 2018, 4:17pm UTC](https://forum.xod.io/t/multiple-input-for-leds/835/4 "2018-06-08T16:17:38Z")

</div>

Something like:

 ![Screenshot%20from%202018-06-08%2019-13-52](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/3afa91ffdd695c92c5af206450401b307bf136da.png)

> [@laupasto15](#):
>
> and can I have more than one input into a LED? I can only see the if else as a “gate” for multiple entries.

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.

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [June 8, 2018, 11:22pm UTC](https://forum.xod.io/t/multiple-input-for-leds/835/5 "2018-06-08T23:22:39Z")

</div>

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

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/bcf7ef82718e124858ce21047830b2db5cf23740.png)

Which uses the fading\_blink module I also created:

 ![image](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/baa6dabe16804c871bfa82057f8e6d4129caf51a.png)

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

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)

---

<div class="post-metadata">

**Author:** ![laupasto15](https://avatars.discourse-cdn.com/v4/letter/l/e9bcb4/32.png) [@laupasto15](https://forum.xod.io/u/laupasto15)\
**Post date:** [June 9, 2018, 12:41am UTC](https://forum.xod.io/t/multiple-input-for-leds/835/6 "2018-06-09T00:41:19Z")

</div>

awesome! thanks a lot

---

<div class="post-metadata">

**Author:** ![laupasto15](https://avatars.discourse-cdn.com/v4/letter/l/e9bcb4/32.png) [@laupasto15](https://forum.xod.io/u/laupasto15)\
**Post date:** [June 9, 2018, 12:41am UTC](https://forum.xod.io/t/multiple-input-for-leds/835/7 "2018-06-09T00:41:34Z")

</div>

awesome! thanks a lot! I will try that today

---

<div class="post-metadata">

**Author:** ![laupasto15](https://avatars.discourse-cdn.com/v4/letter/l/e9bcb4/32.png) [@laupasto15](https://forum.xod.io/u/laupasto15)\
**Post date:** [June 9, 2018, 1:28pm UTC](https://forum.xod.io/t/multiple-input-for-leds/835/8 "2018-06-09T13:28:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [June 10, 2018, 8:47pm UTC](https://forum.xod.io/t/multiple-input-for-leds/835/9 "2018-06-10T20:47:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![laupasto15](https://avatars.discourse-cdn.com/v4/letter/l/e9bcb4/32.png) [@laupasto15](https://forum.xod.io/u/laupasto15)\
**Post date:** [June 11, 2018, 12:35am UTC](https://forum.xod.io/t/multiple-input-for-leds/835/10 "2018-06-11T00:35:39Z")

</div>

Ok. trying that. Thanks for your help!

---

<div class="post-metadata">

**Author:** ![laupasto15](https://avatars.discourse-cdn.com/v4/letter/l/e9bcb4/32.png) [@laupasto15](https://forum.xod.io/u/laupasto15)\
**Post date:** [June 11, 2018, 3:59am UTC](https://forum.xod.io/t/multiple-input-for-leds/835/11 "2018-06-11T03:59:48Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [June 11, 2018, 1:18pm UTC](https://forum.xod.io/t/multiple-input-for-leds/835/12 "2018-06-11T13:18:35Z")

</div>

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