将设备连接至PC,打开设备管理器为设备安装
FTDI驱动
。以win10环境为例,下载匹配操作系统的驱动文件, 并解压,通过设备管理器进行安装。(注:某些系统环境下,需要安装两次,驱动才会生效,未识别的设备名通常为M5Stack
或USB Serial
, Windows推荐使用驱动文件在设备管理器直接进行安装(自定义更新), 可执行文件安装方式可能无法正常工作)。
点击此处,前往下载FTDI驱动
对于MacOS用户安装前请勾选 系统偏好设置
- >安全性与隐私
- >通用
- >允许以下位置下载的App
- > App Store和认可的开发者选项
。
1.打开 Arduino IDE,选择 文件
->首选项
->设置
2.复制下方的 M5Stack 板管理网址到 附加开发板管理器:
中
https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/arduino/package_m5stack_index.json
3.选择 工具
->开发板:
->开发板管理器...
4.在新弹出的对话框中,输入并搜索 M5Stack
,点击安装
(若出现搜索失败的情况,可以尝试重启Arduino程序)
5.选择 工具
->开发板:
->M5Stack Arduino
, 根据我们所使用的设备(M5Stack-Atom
)选择对应的开发板配置.
项目
->加载库
->库管理...
M5Atom
并安装,如下图所示, 下载时请根据弹窗提示,安装相关依赖库。Tools
- > Port
- > COMx
), 点击菜单栏上的上传按钮(->
), 程序将会自动编译,上传至设备。 该程序将点亮ATOM上的LED灯。#include "M5Atom.h"
/* After M5Atom is started or reset
the program in the setUp () function will be run, and this part will only be run once.
在 M5Atom 启动或者复位后,即会开始执行setup()函数中的程序,该部分只会执行一次。 */
void setup(){
M5.begin(true, false, true); //Clear the serial port buffer, set the serial port baud rate to 115200; initialize the LED matrix. 清空串口缓冲区,设置串口波特率为 115200;初始化LED矩阵
delay(50);
M5.dis.fillpix(0xff0000); // Fill 0xff0000 to the entire LED dot matrix. 将 0xff0000 填充至整个LED点阵
}
/* After the program in setup() runs, it runs the program in loop()
The loop() function is an infinite loop in which the program runs repeatedly
在setup()函数中的程序执行完后,会接着执行loop()函数中的程序
loop()函数是一个死循环,其中的程序会不断的重复运行 */
void loop(){
}
Github
Arduino API