Arduino Basic - LED

准备硬件板子

Genuino 2560

注:

  • 需要自带一根USB type-B 到type-A的转接线


    USB line
  • Genuino 与 Arduino的区别

Genuino is Arduino.cc’s sister-brand created by Arduino co-founders Massimo Banzi, David Cuartielles, Tom Igoe, and David Mellis, the Arduino.cc team and community.This brand is used for boards and products sold outside the US.

下载软件 IDE

下载 Arduino IDE

Arduino IDE Download

安装驱动

插上USB链接的板子,提示驱动未安装如下:

Driver not installed

更新驱动程序软件

浏览计算机以查找驱动程序软件

选择Arduino IDE的解压路径下的drivers文件夹,并单击下一步:

选择IDE所在目录的`drivers`子目录

等待安装完成

此时,再看计算机管理,驱动正确安装

COMx

运行跑马灯

打开arduino.exe,并打开跑马灯例程

Blink

打开工具,并选择Arduino对应的板子型号和串口

稍微修改下两灭灯的时间比,如下亮3s,灭1s:

/*
  Blink
  Turns on an LED on for one second, then off for one second, repeatedly.

  Most Arduinos have an on-board LED you can control. On the Uno and
  Leonardo, it is attached to digital pin 13. If you're unsure what
  pin the on-board LED is connected to on your Arduino model, check
  the documentation at http://www.arduino.cc

  This example code is in the public domain.

  modified 8 May 2014
  by Scott Fitzgerald
 */


// the setup function runs once when you press reset or power the board
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(3000);              // wait for a second
  digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);              // wait for a second
}

上传BIN文件到板子(自动编译)

上传

实际效果

运行

参考链接

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容