標題:
基礎數位輸出 (二)
[打印本頁]
作者:
tonyh
時間:
2022-1-9 16:14
標題:
基礎數位輸出 (二)
本帖最後由 tonyh 於 2022-1-23 15:17 編輯
Arduino Uno 版
void setup()
{
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
}
void loop()
{
digitalWrite(10, HIGH);
delay(50);
digitalWrite(10, LOW);
delay(50);
digitalWrite(11, HIGH);
delay(50);
digitalWrite(11, LOW);
delay(50);
digitalWrite(12, HIGH);
delay(50);
digitalWrite(12, LOW);
delay(50);
digitalWrite(13, HIGH);
delay(50);
digitalWrite(13, LOW);
delay(50);
}
複製代碼
WeMos D1 版
void setup()
{
pinMode(D10, OUTPUT);
pinMode(D11, OUTPUT);
pinMode(D12, OUTPUT);
pinMode(D13, OUTPUT);
}
void loop()
{
digitalWrite(D10, HIGH);
delay(50);
digitalWrite(D10, LOW);
delay(50);
digitalWrite(D11, HIGH);
delay(50);
digitalWrite(D11, LOW);
delay(50);
digitalWrite(D12, HIGH);
delay(50);
digitalWrite(D12, LOW);
delay(50);
digitalWrite(D13, HIGH);
delay(50);
digitalWrite(D13, LOW);
delay(50);
}
複製代碼
作者:
劉愷鈞
時間:
2022-1-9 16:48
// C++ code
//
void setup()
{
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
}
void loop()
{
digitalWrite(13, HIGH);
delay(50);
digitalWrite(13, LOW);
delay(50);
digitalWrite(12, HIGH);
delay(50);
digitalWrite(12, LOW);
delay(50);
digitalWrite(11, HIGH);
delay(50);
digitalWrite(11, LOW);
delay(50);
digitalWrite(10, HIGH);
delay(50);
digitalWrite(10, LOW);
delay(50);
}
複製代碼
作者:
洪承廷
時間:
2022-1-9 16:50
// C++ code
//
void setup()
{
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
}
void loop()
{
digitalWrite(13, HIGH);
delay(50);
digitalWrite(13, LOW);
delay(50);
digitalWrite(12, HIGH);
delay(50);
digitalWrite(12, LOW);
delay(50);
digitalWrite(11, HIGH);
delay(50);
digitalWrite(11, LOW);
delay(50);
digitalWrite(10, HIGH);
delay(50);
digitalWrite(10, LOW);
delay(50);
}
複製代碼
作者:
謝以恩
時間:
2022-1-9 16:51
void setup()
{
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
}
void loop()
{
digitalWrite(10, HIGH);
delay(50);
digitalWrite(10, LOW);
delay(50);
digitalWrite(11, HIGH);
delay(50);
digitalWrite(11, LOW);
delay(50);
digitalWrite(12, HIGH);
delay(50);
digitalWrite(12, LOW);
delay(50);
digitalWrite(13, HIGH);
delay(50);
digitalWrite(13, LOW);
delay(50);
}
複製代碼
作者:
尤爾呈
時間:
2022-1-9 16:51
// C++ code
//
void setup()
{
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
}
void loop()
{
digitalWrite(13, HIGH);
delay(500); // Wait for 1000 millisecond(s)
digitalWrite(13, LOW);
delay(500); // Wait for 1000 millisecond(s)
digitalWrite(12, HIGH);
delay(500); // Wait for 1000 millisecond(s)
digitalWrite(12, LOW);
delay(500); // Wait for 1000 millisecond(s)
digitalWrite(11, HIGH);
delay(500); // Wait for 1000 millisecond(s)
digitalWrite(11, LOW);
delay(500); // Wait for 1000 millisecond(s)
digitalWrite(10, HIGH);
delay(500); // Wait for 1000 millisecond(s)
digitalWrite(10, LOW);
delay(500); // Wait for 1000 millisecond(s)
}
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2