From 4908c9a7a038ab4e9ba5e61319ffec74fac5cdee Mon Sep 17 00:00:00 2001 From: wancat Date: Wed, 2 Mar 2022 10:04:12 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=91=E9=A6=AC=E7=87=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helloworld/helloworld.ino | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 helloworld/helloworld.ino diff --git a/helloworld/helloworld.ino b/helloworld/helloworld.ino new file mode 100644 index 0000000..72a30eb --- /dev/null +++ b/helloworld/helloworld.ino @@ -0,0 +1,21 @@ +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); +}