Files
arduino/helloworld/helloworld.ino
2022-03-02 10:04:12 +08:00

22 lines
436 B
C++

int LED[] = {5, 6, 9, 10, 11};
int val[5] = {250, 150, 0, 150, 250};
int clk = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
for (int i = 0; i < 5; i++) {
pinMode(LED[i], OUTPUT);
digitalWrite(LED[i], HIGH);
}
}
void loop() {
// put your main code here, to run repeatedly:
for (int i = 0; i < 5; i++) {
analogWrite(LED[i], val[(i + clk) % 5]);
}
clk += 1;
delay(200);
}