RGB LED example

This was a quick test for a multi color LED. Pins 2, 3 and 4 were used

 
[c]
int red = 2;
int green =3;
int blue =4;
int j;

void setup()
{
pinMode(red,OUTPUT);
pinMode(green,OUTPUT);
pinMode(blue,OUTPUT);
}

void loop()
{
for (j = 1; j < 10000; j++)
{
analogWrite(red,random(255));
delay (random(10,31));
analogWrite(green,random(255));
delay (random(10,31));
analogWrite(blue,random(255));
delay (random(10,31));
}
}
[/c]

Related posts

Arduino Uno and PCT2075 temperature sensor

Arduino Uno and AHT20 Integrated temperature and humidity Sensor

Arduino Uno and LTR390 UV Light Sensor

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Read More