Arduino教程:驱动安装及下载Blink程序
扫描二维码
随时随地手机看文章
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。
下载完毕!
/*BlinkTurns 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 seconddigitalWrite(led, LOW); // turn the LED off by making the voltage LOWdelay(1000); // wait for a second}
/*BlinkTurns 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;
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 seconddigitalWrite(led, LOW); // turn the LED off by making the voltage LOWdelay(1000); // wait for a second}
digitalWrite(led, HIGH);
delay(1000);
digitalWrite(led, LOW);delay(1000);
免责声明:本文内容由21ic获得授权后发布,版权归原作者所有,本平台仅提供信息存储服务。文章仅代表作者个人观点,不代表本平台立场,如有问题,请联系我们,谢谢!





