RGB LED
Last updated
Was this helpful?
Last updated
Was this helpful?
You know how to get a handle on the LED connected to your computer
You can set the color of the LED, turn it on and off, and make it blink
Using the in our program is straightforward. In this article, we assume you have successfully initialized the devices with the , and you stored all connected devices on a global variable devices
. We also declared a global variable led
.
Next, we need to know the device identifier of the RGB LED, which is 271:
Now that we have a reference to the LED on the variable led
, we can use that variable to call the LED's functions.
With setColor()
we can turn the LED on and specify the color of the light. We define the color using the RGB notation:
We can turn the LED off (black) at any time with the shortcut function off()
:
Similar to setting the color, we can use blink()
to make the LED blink at a given frequency:
That's it, we can't do more with an .