This is an old revision of the document!
Project owner: | lichnak, PeterBay |
Interested: | |
Related: | |
Reference: | https://Espressif.com |
License: | Uveďte původ-Zachovejte licenci; CC BY-SA |
Project owner: | lichnak, PeterBay |
Interested: | |
Related: | |
Reference: | https://Espressif.com |
License: | Uveďte původ-Zachovejte licenci; CC BY-SA |
NodeMCU HTTP Server
PB hero
Deploy httpd to ESP8266
- Copy file
httpd.c
to folderapp/modules/
cp httpd.c ~/nodemcu-firmware/nodemcu-firmware-2.0.0-master_20170202/app/modules/
- Edit file
app/include/user_modules.h
and add one line to user modules.
mcedit ~/nodemcu-firmware/nodemcu-firmware-2.0.0-master_20170202/app/include/user_modules.h #define LUA_USE_MODULES_HTTPD
- Compile firmware as was descibed here.
- Connect nodeMCU to USB
- Open ESPlorer
- Connect to nodeMCU
Formatting file system. Please wait... Waiting answer from ESP - Timeout reached. Command aborted. Formatting file system. Please wait... NodeMCU 2.0.0 build unspecified powered by Lua 5.1.4 on SDK 2.0.0(656edbf) lua: cannot open init.lua >
- Upload httpd files to ESP8266
> Uploading to ESP file about.tmpl...Success > Uploading to ESP file api.tmpl...Success > Uploading to ESP file assemble.lua...Success > Uploading to ESP file console.tmpl...Success > Uploading to ESP file edit.tmpl...Success > Uploading to ESP file ext_httpd.lua...Success > Uploading to ESP file ext_wifi.lua...Success > Uploading to ESP file ext_wifi_settings.lua...Success > Uploading to ESP file favicon.ico...Success > Uploading to ESP file gpio.tmpl...Success > Uploading to ESP file gpio_set.tmpl...Success > Uploading to ESP file httpd.lua...Success > Uploading to ESP file index.tmpl...Success > Uploading to ESP file init.lua...Success > Uploading to ESP file page.tmpl...Success > Uploading to ESP file static__console.js...Success > Uploading to ESP file static__favicon.ico...Success > Uploading to ESP file static__node.css...Success > Uploading to ESP file static__node.js...Success > Uploading to ESP file static__svg.js...Success > Uploading to ESP file wifi.tmpl...Success
- Verify size of uploaded files
> ---------------------------- about.tmpl : 454 bytes api.tmpl : 107 bytes assemble.lua : 1774 bytes console.tmpl : 1578 bytes edit.tmpl : 1099 bytes ext_httpd.lua : 1345 bytes ext_wifi.lua : 1225 bytes ext_wifi_settings.lua : 320 bytes favicon.ico : 1078 bytes gpio.tmpl : 1275 bytes gpio_set.tmpl : 1430 bytes httpd.lua : 4110 bytes index.tmpl : 1210 bytes init.lua : 150 bytes page.tmpl : 842 bytes static__console.js : 1611 bytes static__favicon.ico : 1078 bytes static__node.css : 2703 bytes static__node.js : 2777 bytes static__svg.js : 2791 bytes wifi.tmpl : 779 bytes ---------------------------- Total file(s) : 21 Total size : 29736 bytes Total : 3384986 bytes Used : 38152 bytes Remain: 3346834 bytes
- Configure script
ext_wifi_settings.lua
for WiFi connection strings - Execute on ESP8266 script
assemble.lua
- Open http://nodeMCU-IP-Address in Web browser