Preparatory work
1.NodeMCU Module
2.esp8266flasher.exe
3.ESPlorer V0.2.0-RC6
Building firmware
Building The firmware provides three ways to build your own firmware.
It is recommended to use the simple cloud build service NODEMCU Custom builds to customize your own firmware, just choose the library you need on the site, leave the mailbox, will be able to receive the compiled firmware.
I chose these libraries:Cjson,crypto,file,gpio,http,mqtt,net,node,pwm,tmr,uart,wifi,
You selected the following modules: crypto
file
gpio
http
mqtt
net
node
pwm
sjson
tmr
uart
wifi
.
and checked the
TLS/SSL support provided by mbed Tls:tls 1.0/1.1/1.2 and most common cipher suites including DH/ECDH (ecdsa-based dis abled by default).
You can receive the firmware in the mailbox in a few minutes, which is divided into two versions of float and integer, please download it within 24 hours.
Swipe in firmware
Download the release version of Nodemcu-flasher and note the number of operating system bits.
Connect Nodemcu to your computer and run flasher.
Under the Config tab, configure the path of your own firmware, I chose the float version.
Then go back to operation , click Flash (F), wait a moment. The blue light flashes during the write process.
Upload Code
Uploading code also provides a variety of tools to upload codes and files to NODEMCU.
It is recommended to use Esplorer, which requires a Java environment . Download Esplorer.zip.
After decompression, run esplorer.bat.
At the top right of the Esplorer window, set the port number.
Click Openand press the RST button on the NODEMCU to restart.
Create a Init.lua file that causes the NODEMCU to connect to an AP (Access point) and configure the SSID and password by modifying the fourth line of code. For open networks, use empty text as the password.
--Init.luaprint ('Setting up WIFI ...') Wifi.setmode (WiFi. Station) Wifi.sta.config ('WX401901','smyh1234') Wifi.sta.connect () Tmr.alarm (1, +, TMR. Alarm_auto, function ()ifWifi.sta.getip () = =Nil then print ('waiting for IP ...') ElsePrint ('IP is'.. wifi.sta.getip ()) Tmr.stop (1) endend)
After saving, click the Upload in the lower left area of the Esplorer window ... to upload.
Restart NODEMCU after uploading. If everything is OK, you will see NODEMCU successfully connected to your AP.
Related Resources
NODEMCU Documentation
NODEMCU Custom Builds
Nodemcu-flasher
Esplorer.zip
You can also download the relevant resources and code for this article in Nodemcu-tutorial.
This article is in Nodemcu Journey (a): build, brush into firmware, upload code based on the learning process, thanks to the original author.
NODEMCU Primer (2): Custom build, flash firmware, upload code