void setup() {
pinMode(9, OUTPUT);
}
void loop() {
for (int i = 0; i <= 180; i += 1) {
digitalWrite(9, HIGH);
delayMicroseconds(500 + i);
digitalWrite(9, LOW);
delayMicroseconds(20000 - i * 100);
}
delay(1000);
for (int i = 180; i >= 0; i -= 1) {
digitalWrite(9, HIGH);
delayMicroseconds(500 + i);
digitalWrite(9, LOW);
delayMicroseconds(20000 - i * 100);
}
delay(1000);
}
暂无评论