Getting Started with Noduino on Linux
目录 |
1 准备开发板和USB连接线
准备一块 nodemcu v1.0 开发板,一根 micro USB 连接线:
2 下载Arduino软件
2.1 Git 安装
先从 arduino.cc 下载 1.6.6 版本的压缩包,解压后,进入:
$ cd /PATH/TO/arduino $ cd hardware $ mkdir esp8266com $ cd esp8266com $ git clone git://github.com/icamgo/Noduino.git esp8266 # fetch the toolchain of esp8266 $ cd esp8266 $ git submodule init $ git submodule update $ cd tools/xtensa-toolchain # Generate the toolchain (you need Python 2.7) $ ./gen.py
重启 Arduino 即可
2.2 压缩包
Arduino 软件开发环境是一个压缩包,下载解压后直接运行,即可使用。定制的版本位于:
百度云:http://pan.baidu.com/s/1qWkVJgo
微盘:http://vdisk.weibo.com/s/dn5OZrwbJHDa
下载 noduino-1.6.6-linux32.tar.xz 或者 noduino-1.6.6-linux64.tar.xz (64位系统)。留意一下用 md5sum 对压缩包进行完整性检查:
解压后,找到 Arduino,此为 Arduino IDE 主程序
3 连接开发板
Micro USB 线的 microUSB 口连接 nodemcu 开发板,USB 口接 PC 的 USB 口。
开发板从 USB 口取电,开发板带 USB 转串口功能
PC 可通过这个 USB 线与开发板交换数据
4 安装驱动程序
开发板使用 CP2102 这颗 USB 转串口芯片,Linux 系统下无需额外安装驱动,插上开发板后,系统自动将其识别为 /dev/ttyUSB0 这个串口设备:
comcat@jackslab:/work/xwifi/noduino$ dmesg|tail -n 6 [254109.926619] usb 4-1: Product: CP2102 USB to UART Bridge Controller [254109.926625] usb 4-1: Manufacturer: Silicon Labs [254109.926630] usb 4-1: SerialNumber: 0001 [254109.931456] cp210x 4-1:1.0: cp210x converter detected [254110.044391] usb 4-1: reset full-speed USB device number 22 using uhci_hcd [254110.192809] usb 4-1: cp210x converter now attached to ttyUSB0
5 启动Arduino软件
双击解压后目录下的 Arduino
6 选择开发板
选择开发板为: "NodeMCU 1.0 (ESP-12E Module)" :
7 选择串行端口
从“工具|串口”菜单中选择开发板的串口设备,由前面设备发现过程可知道,Linux 将开发板的串口识别为 /dev/ttyUSB0
至此板级相关的参数为:
- Board: "NodeMCU 1.0 (ESP-12E Module)"
- CPU Frequency: "80 MHz"
- Upload Speed: "115200"
- Port: "/dev/ttyUSB0"
8 打开闪烁示例
9 上传程序
在 Arduino IDE 中点击“上传”(Upload) 按钮。稍等片刻,你就会看到板子上模块的蓝色 LED 灯在快闪。
如果上传成功,状态栏会出现“上传成功”(Done uploading) 的字样
上传完之后,你会很快看到板子靠近 USB 口的 LED 开始在慢闪(大概 1s 间隔),证明上传成功,你已经把 Noduino IDE 跑起来了!
10 扩展阅读
Arduino 的 Mac OS X 和 Windows 的版本可以参考此页:
- Getting Started with Noduino on Linux
- Getting Started with Noduino on Mac OS X
- Getting Started with Noduino on Windows
产品级开发建议使用我们的专业 SDK:
- Getting Started with Noduino SDK on Linux
- Getting Started with Noduino SDK on Mac OS X
- Getting Started with Noduino SDK on Windows