RGB Led Blink
This is a simple script to test RGB led functionality. It first lights up the RED, GREEN, BLUE componenst of the RGB led, thent it makes the light darker then lighter. It is a fun way to test and demonstrate the functinality of the RGB led example.
This is the source code for you to copy
using System; using System.Media; using System.Threading; namespace Ozeki { public class Program { public void Start() { SystemSounds.Beep.Play(); for (int x=0;x<10;x++) { Send("MyRGBLed@localhost","green"); Thread.Sleep(500); Send("MyRGBLed@localhost","red"); Thread.Sleep(500); Send("MyRGBLed@localhost","blue"); Thread.Sleep(500); } for (int x=0;x<30;x++) { Send("MyRGBLed@localhost","darker"); Thread.Sleep(500); } for (int x=0;x<30;x++) { Send("MyRGBLed@localhost","lighter"); Thread.Sleep(500); } } } };
In this Robot Controller, we can control all the connected entites with
programming using simple text messages. Let’s try it!
The code below will turn the RGB LED strip to green then red and vice versa 10
times. So copy the code then paste it into the editor then compile and run it.
You will see the messages on the built-in console and the LED strip will light
up and change its color.
Here is the code to copy. Paste it into the Robot Controller.
using System; using System.Threading; namespace Ozeki { public class Program { public void Start() { for(int x=0; x<10; x++) { Send("MyRGBLed@localhost", "green"); Thread.Sleep(500); Send("MyRGBLed@localhost", "red"); Thread.Sleep(500); } } } };
More information