Nodemcu开发之Win IDE

导读:之前买的新板子,无法直接刷程序,直接在win下又做了一次固件刷写,其实和之前mac上写的写法类似,都很简单

一共有两个比较好用,其中一个是

ESPlorer

https://esp8266.ru/esplorer/

  1. win10自带了串口驱动usb2uart,很赞
  2. 环境搭建

下载最新的jdk9和ESPlorer有冲突, 无法点击open连接, 这里有讨论,下载jdk8可以解决
https://github.com/4refr0nt/ESPlorer/issues/63
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

  1. 软件连接
    选择ide下的com口,在设备管理器的串口中找到usb to uart这个对应的com口号, 在右上角选择对应的端口
    选择对应的频率,点击open,可反复试,通过我之前的文章可以手动刷固件同时给mcu改通信频率

4.刷固件
同mac版文章类似
https://www.jianshu.com/p/e06c621d32fb
不同点:

  • 下载对应win的python环境 https://www.python.org/downloads/
  • win下获取端口dos下使用chgport获取串口名

笔者列表, 如果你不确定是哪个端口,插拔你的nodemcu,端口列表会有增删
C:\Users\admin>chgport
AUX = \DosDevices\COM1
COM1 = \Device\Serial0
COM3 = \Device\Silabser0

  • 安装esptool.py是全局环境了,不需要mac那样前面加路径
  • 格式化nodemcu

esptool.py --port COM3 erase_flash
esptool.py v2.0.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 7.0s
Hard resetting...

  • 获取nodemcu容量

esptool.py --port COM3 flash_id
esptool.py v2.0.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266
Uploading stub...
Running stub...
Stub running...
Manufacturer: ef
Device: 4016
Detected flash size: 4MB
Hard resetting...

  • 刷固件, 因为笔者去年做过固件,所以直接拿了以前的固件来做,你可以到官网上去制作

esptool.py --port COM3 write_flash -fm dio 0x00000 "./package/nodemcu-master-23-modules-2017-07-11-06-57-55-float.bin"
esptool.py v2.0.1
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Flash params set to 0x0240
Compressed 668672 bytes to 438783...
Wrote 668672 bytes (438783 compressed) at 0x00000000 in 42.2 seconds (effective 126.7 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting...

连接esplorer如果未出现下面信息请重刷固件

NodeMCU custom build by frightanic.com
    branch: master
    commit: c8ac5cfb912ff206b03dd7c60ffbb2dafb83fe5e
    SSL: false
    modules: adc,bit,coap,crypto,enduser_setup,file,gpio,http,mqtt,net,node,pcm,pwm,rtcfifo,rtcmem,rtctime,sjson,sntp,tmr,uart,websocket,wifi,ws2801
 build  built on: 2017-07-11 06:56
 powered by Lua 5.1.4 on SDK 2.1.0(116b762)
lua: cannot open init.lua
  • 好久不碰NodeMcu了,试试最简单的板子上led灯发光的小程序
LED_PIN = 0
US_TO_MS = 1000
gpio.mode(LED_PIN, gpio.OUTPUT)

while true do
   gpio.write(LED_PIN, gpio.HIGH)
   tmr.delay(500 * US_TO_MS)
   gpio.write(LED_PIN, gpio.LOW)
   tmr.delay(500 * US_TO_MS)
end

Arduino

https://www.jianshu.com/p/af28ee8a3d06

你可能感兴趣的:(Nodemcu开发之Win IDE)