#define RedPin 4
#define GreenPin 2
#define BluePin 15
#define Time 30
void setup()
{
Serial.begin(115200);
pinMode(RedPin, OUTPUT);
pinMode(GreenPin, OUTPUT);
pinMode(BluePin, OUTPUT);
}
void RGB(int RValue, int GValue, int BValue)
{
analogWrite(RedPin, RValue);
analogWrite(GreenPin, GValue);
analogWrite(BluePin, BValue);
delay(Time);
}
void loop()
{
for(int i=0; i<256; i++)
{
RGB(255, i, 0);
}
for(int i=256; i>128; i--)
{
RGB(i , 255, 0);
}
for(int i=0; i<256; i++)
{
RGB(128 , 255, i);
}
for(int i=128; i>0; i--)
{
RGB(i , i+128, 255);
}
for(int i=128; i>0; i--)
{
RGB(0 , i, 255);
}
for(int i=0; i<256; i++)
{
RGB(i , 0, 255);
}
for(int i=256; i>0; i--)
{
RGB(255 , 0, i);
}
}