Arduino教程:驅(qū)動(dòng)安裝及下載Blink程序
STEP 1:下載Arduino IDE
打開(kāi)網(wǎng)頁(yè)輸入網(wǎng)址http://arduino.cc/en/Main/Software
Arduino IDE老版本下載鏈接:http://arduino.cc/en/Main/OldSoftwareReleases
進(jìn)入到頁(yè)面后,找到下圖顯示部分。
插上USB線,打開(kāi)Arduino IDE后,找到“Blink”代碼。
通常,寫完一段代碼后,我們都需要校驗(yàn)一下,看看代碼有沒(méi)有錯(cuò)誤。點(diǎn)擊“校驗(yàn)”。
下圖顯示了正在校驗(yàn)中。
在下載程序之前,我們還要先告訴Arduino IDE板子型號(hào)以及相應(yīng)的串口。
選擇所用的板卡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:
復(fù)制代碼
"http://",這是另一種注釋方法,表示這個(gè)符號(hào)所在行之后的文字將被注釋掉。
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);
免責(zé)聲明:本文內(nèi)容由21ic獲得授權(quán)后發(fā)布,版權(quán)歸原作者所有,本平臺(tái)僅提供信息存儲(chǔ)服務(wù)。文章僅代表作者個(gè)人觀點(diǎn),不代表本平臺(tái)立場(chǎng),如有問(wèn)題,請(qǐng)聯(lián)系我們,謝謝!