RGB LED strip, how to change color at a given point in time?

Hello! For example, 000 sec. - white, 028 sec. - purple, 116 sec. - lime, etc. How to implement this? Thanks!

Maybe you can hook up a timer node to a count node and use lesser and greater nodes to send a boolean to flip flop nodes. I dont own rgb led strip so I’m not sure how they work in operations for how they change the color on the strip.

Edit: Actually you can probably just connect the timer directly to the lesser and greater nodes.

This is pretty much exactly what the traffic light example does…just instead of using an LED node, you will use a node that sends signal to select specific color.

Well, how can I get, for example, color - # 14CDD2
(20,205,210) with 126 – 130 sec., and then this color - # 4AD214
(74,210,20) with 131 – 135 sec. ? The delay node has boolean\pulse output only.

Have you looked at traffic light examples? Basically, you need to use pulses to control what part of the program is being executed when. I don’t know what nodes you are using to send the colors to LED; I assume they accept a pulse or boolean to indicate when the value should be sent. The ACT boolean or DONE pulse from the delay node can be used to “activate” that color, then start the next delay node to time how long that color stays on before the next color is sent and another delay started.

https://xod.io/docs/guide/#case-studies has lots of sample code, including https://xod.io/docs/guide/simple-traffic-light/. If you want a deep dive, there is the library gweimer/traffic-light-advanced.

1 Like

will it not be difficult for you to send an example of a picture? I’m completely confused.

Oh. So you need to change the pwm multiple times for “R” , “G” , and “B” outputs. That does sound pretty confusing lol

I’m not familiar with all the nodes in xod. It may not be too hard to do if there is a node that will send out a number value when it receives a true boolean signal. Is there a node for this in Xod?

what am I doing wrong? Tell me please! better with pictures.

What node are you using that is labeled RED GREEN BLUE?

this node is called “switch-case”

Here is a solution that closely parallels yours using select nodes for RED GREEN BLUE.

boot node selects X1 values on startup and starts 1st delay timer. After 1st delay, DONE pulse selects X2 values and starts next delay timer, etc.

An alternative is to have multiple rgb-led nodes providing different values, and only have the “correct” node send its data when it is time:

This assumes that your rgb-led node does nothing when it is not getting an UPD pulse (which is implied by the fact it has an UPD pin…).

1 Like

Ah…switch-case is going to keep switching back to default value. When count is 0, 1, 2, 4, 5, 6, or bigger than 7, you will get DEF value. When it is 3, you will get Y1 value, When it is 7, you will get Y2 value. Are you wanting that, or was your intention to have initial color for 3 seconds, then 2nd color for 4 seconds, then 3rd color?

Fine!!! thank you so much! The picture message contains a solution to my problem! Thanks again!

If you want to keep your clock-based timing instead of using delay nodes, you could also do something like this with pulse-on-true nodes sending pulse when count equals a specific value:

1 Like

How do you reset a upd after it recieved a signal? I’ve tried using defer node and looping to the first node of the process and it never resets unless I turn the microcontroller itself off.

UPD pin is looking for a pulse. It will “work” each time the pin gets a pulse; there is no need to reset it.

I think you are asking how to repeat the program? If you have a chain of delay nodes, you need to loop the last delay-DONE back to the first delay-SET. Since it is creating a loop, you will need a defer node. Since you can only have one wire to an input pin, and the first delay-SET already links to ‘boot’ node, you will need to join the signals using an ‘any’ node.


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.