A question comes up quite often among users of Yocto-Color and of Yocto-PowerColor modules: Can you make the RGB led of these two modules blink automatically? This is not a crazy idea. When you see what a Yoctopuce relay can do, you can expect similar features with a Yoctopuce RGB led.
To tell you the truth, this blinking issue was lying around in the office for a long while. We would have liked to make something as easy to use and comfortable as the background animation concept that you can find in Yoctopuce screens. Unfortunately, the processor used in the Yocto-Color and in the Yocto-PowerColor doesn't have enough memory to allow us such luxury.
A Yocto-Color and a Yocto-MiniDisplay: check out the processors
On the other hand, we didn't just want to offer an on/off feature. This would have been very limiting for an RGB led. Therefore, we opted for an intermediary solution.
How it works
We introduced the notion of sequence in the latest Yocto-Color and Yocto-PowerColor firmware. A sequence is a succession of transitions which are performed in a given time. For example, becoming red in a second, then black in a second. Thus, to make a Yoctopuce led vary automatically, you must simply program these two transitions and then ask the module to run this sequence. Here is a short example in command line.
C:\>ycolorled any addRgbMoveToBlinkSeq 0xFF0000 1000 OK: YRGBLED1-00164.colorLed2.addRgbMoveToBlinkSeq = 16711680 1000. C:\>ycolorled any addRgbMoveToBlinkSeq 0x000000 1000 OK: YRGBLED1-00164.colorLed2.addRgbMoveToBlinkSeq = 0 1000. C:\>ycolorled any startBlinkSeq OK: YRGBLED1-00164.colorLed2.startBlinkSeq = .
This sequence runs in a loop until you stop it explicitely, until you change the led color, or until you erase the sequence with resetBlinkSeq.
C:\>ycolorled any stopBlinkSeq OK: YRGBLED1-00164.colorLed2.startBlinkSeq = . C:\>ycolorled any resetBlinkSeq OK: YRGBLED1-00164.colorLed2.resetBlinkSeq = .
In this example, transitions between red and black are progressive. How can you make them instantaneous? It's slightly more complex, you need twice as many transitions. One with a null transition time, and a second with the time during which you want the color to remain constant.
C:\>ycolorled any addRgbMoveToBlinkSeq 0xFF0000 0 OK: YRGBLED1-00164.colorLed2.addRgbMoveToBlinkSeq = 16711680 0. C:\>ycolorled any addRgbMoveToBlinkSeq 0xFF0000 1000 OK: YRGBLED1-00164.colorLed2.addRgbMoveToBlinkSeq = 16711680 1000. C:\>ycolorled any addRgbMoveToBlinkSeq 0x000000 0 OK: YRGBLED1-00164.colorLed2.addRgbMoveToBlinkSeq = 0 0. C:\>ycolorled any addRgbMoveToBlinkSeq 0x000000 1000 OK: YRGBLED1-00164.colorLed2.addRgbMoveToBlinkSeq = 0 1000.
Indeed, this programming technique based on transitions makes simple things somewhat more complex than complex things :-). However, it offers an incredible range of possibilities: "Saturday night fever" sequences are now yours! Here is a short video illustrating a few of these possibilities.
If you compare these sequences with Yoctopuce screen background animations, there are some limitations, mostly due to the restricted memory available on the Yocto-Color and on the Yocto-PowerColor.
- A sequence is limited to 32 transitions.
- You can have only one sequence per led at a given time.
- The sequence is stored in the module RAM. If the module is disconnected the sequence disappears.
Here you are, you know everything. We hope that this new feature will fulfil your expectations. If you want to test it, don't forget to retrieve the latest firmware version for your Yocto-(Power)Color and the latest API version corresponding to your preferred programming language.