網站地圖 網站地圖
LED 控制 LED 控制

 使用Arduino可將程式嵌入進在路板

將電路板插入USB從裝置管理員可看到Arduino Uno 為COM3的插槽,所以要在Arduino上選則COM3的插槽,再按下箭頭可上傳程式進電路板。

依程式open-blink範例:可調整pin 13腳位通電斷電以達到LED開關的時間控制

 void setup() {

  // initialize digital pin 13 as an output.

  pinMode(13, OUTPUT);

}


// the loop function runs over and over again forever

void loop() {

  digitalWrite(13, HIGH);   // turn the LED on (HIGH is the voltage level)

  delay(50);                // wait for a second

  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW

  delay(3000);              // wait for a second

}