程式功能:該範例程式是在於控制Arduino板子上P13腳位的LED燈熄滅的功能。
測試前準備:必須要將LED燈的正電腳插在P13腳位的位置,將LED燈的負電腳插在隔壁GND腳位中即可。
以下為範例程式程式碼:
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
void setup() {
// initialize the digital pin as an output.
// Pin 13 has an LED connected on most Arduino boards:
pinMode(13, OUTPUT); //設定腳位(Pin13)
}
void loop() {
digitalWrite(13, HIGH); // set the LED on 開啟LED燈
delay(1000); // wait for a second 延遲1秒
digitalWrite(13, LOW); // set the LED off 關閉LED燈
delay(1000); // wait for a second 延遲1秒
}