STEP 1:下載Arduino IDE
打開網頁輸入網址http://arduino.cc/en/Main/Software
Arduino IDE老版本下載鏈接:http://arduino.cc/en/Main/OldSoftwareReleases
進入到頁面后,動安找到下圖顯示部分。裝及
插上USB線,打開Arduino IDE后,找到“Blink”代碼。
通常,寫完一段代碼后,我們都需要校驗一下,看看代碼有沒有錯誤。點擊“校驗”。
下圖顯示了正在校驗中。
在下載程序之前,我們還要先告訴Arduino IDE板子型號以及相應的串口。
選擇所用的板卡Board -->Arduino UNO。
下載完畢!
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 13;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
*/
// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
復制代碼
"http://",這是另一種注釋方法,表示這個符號所在行之后的文字將被注釋掉。
int?led?=?13;
void setup() {
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}
pinMode(led, OUTPUT);
void loop() {
digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
digitalWrite(led, HIGH);
delay(1000);
digitalWrite(led, LOW);
delay(1000);
免責聲明:本文內容由21ic獲得授權后發布,版權歸原作者所有,本平臺僅提供信息存儲服務。文章僅代表作者個人觀點,不代表本平臺立場,如有問題,請聯系我們,謝謝!