int redPin = 11;
int greenPin = 10;
int bluePin = 9;
void setup()
{
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}
void loop()
{
RGB(255,0,0);
delay(1000);
RGB(255,50,0);
delay(1000);
RGB(255,100,0);
delay(1000);
RGB(0,255,0);
delay(1000);
RGB(0,255,80);
delay(1000);
RGB(0,0,255);
delay(1000);
RGB(255,0,200);
delay(1000);
}
void RGB(int red, int green, int blue)
{
analogWrite(redPin, red);
analogWrite(greenPin, green);
analogWrite(bluePin, blue);
}
彩虹RGB
最新推荐文章于 2023-03-18 14:39:36 发布