Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
project:nodemcu_httpd:en [2017/03/12 14:14] licho |
project:nodemcu_httpd:en [2017/03/25 10:39] licho |
||
---|---|---|---|
Line 3: | Line 3: | ||
|**Related:**| | | |**Related:**| | | ||
|**Reference:**| https://Espressif.com | | |**Reference:**| https://Espressif.com | | ||
- | | **License:** | [[https://creativecommons.org/licenses/by-sa/4.0/|Uveďte původ-Zachovejte licenci; CC BY-SA]] | | + | | **License:** | [[http://creativecommons.org/licenses/by-sa/4.0/|Attribution-ShareAlike 4.0 International; CC BY-SA]] | |
====== NodeMCU HTTP Server ====== | ====== NodeMCU HTTP Server ====== | ||
- | PB hero | + | [[user:peterbay,|PeterBay]] hero |
=== Deploy httpd to ESP8266 === | === Deploy httpd to ESP8266 === | ||
+ | * Download ''httpd.c'' [[https://raw.githubusercontent.com/lichnak/nodemcu-labka/master/src/node_server_20170311/firmware/httpd.c|here.]] | ||
* Copy file ''httpd.c'' to folder ''app/modules/'' | * Copy file ''httpd.c'' to folder ''app/modules/'' | ||
<code> | <code> | ||
Line 18: | Line 19: | ||
#define LUA_USE_MODULES_HTTPD | #define LUA_USE_MODULES_HTTPD | ||
</code> | </code> | ||
- | * Compile firmware as was descibed [[:project:nodemcu_lbe:en|here.]] | + | * Compile firmware as was descibed [[:project:nodemcu_lbe:en|here]] or download compiled bootloader [[https://github.com/lichnak/nodemcu-labka/raw/master/src/node_server_20170311/firmware/0x00000.bin|here]] and firmware [[https://github.com/lichnak/nodemcu-labka/raw/master/src/node_server_20170311/firmware/0x10000.bin|here]] |
- | * Upload firmware to ESP8266 as was descibed for Windows 10 [[:project:nodemcu_windev:en|here]] and for Ubuntu [[:project:nodemcu_ubudev:en|here]] | + | |
* Connect nodeMCU to USB | * Connect nodeMCU to USB | ||
- | * Open ESPlorer | + | {{ project:wiki_nodemcu_lolin.png }} |
- | * Connect to nodeMCU | + | * Upload bootloader //bin/0x00000.bin// and firmware //bin/0x10000.bin// to ESP8266 as was descibed for Windows 10 [[:project:nodemcu_windev:en|here]] and for Ubuntu [[:project:nodemcu_ubudev:en|here]] |
+ | {{ project:wiki_nodemcu_esp8266flasher_dual.png?300 }} | ||
+ | * Open ESPlorer and connect to nodeMCU | ||
<code> | <code> | ||
Formatting file system. Please wait... | Formatting file system. Please wait... | ||
Line 56: | Line 58: | ||
> Uploading to ESP file wifi.tmpl...Success | > Uploading to ESP file wifi.tmpl...Success | ||
</code> | </code> | ||
- | * Verify size of uploaded files | + | * Configure script ''ext_wifi_settings.lua'' for WiFi connection strings |
<code> | <code> | ||
- | > | + | > file.open("ext_wifi_settings.lua","w+"); |
- | ---------------------------- | + | > w = file.writeline |
- | about.tmpl : 454 bytes | + | > w([==[wifiSSID="YOUR_WIFI_SSID"]==]); |
- | api.tmpl : 107 bytes | + | > w([==[wifiPassword="YOUR_WIFI_PASSPHRASE"]==]); |
- | assemble.lua : 1774 bytes | + | > file.close(); |
- | console.tmpl : 1578 bytes | + | </code> |
- | edit.tmpl : 1099 bytes | + | * On ESP8266 execute script ''assemble.lua'' |
- | ext_httpd.lua : 1345 bytes | + | <code> |
- | ext_wifi.lua : 1225 bytes | + | > dofile("assemble.lua") |
- | ext_wifi_settings.lua : 320 bytes | + | remove: static/console.js |
- | favicon.ico : 1078 bytes | + | rename: static__console.js -> static/console.js |
- | gpio.tmpl : 1275 bytes | + | remove: static/node.css |
- | gpio_set.tmpl : 1430 bytes | + | rename: static__node.css -> static/node.css |
- | httpd.lua : 4110 bytes | + | remove: static/node.js |
- | index.tmpl : 1210 bytes | + | rename: static__node.js -> static/node.js |
- | init.lua : 150 bytes | + | remove: static/svg.js |
- | page.tmpl : 842 bytes | + | rename: static__svg.js -> static/svg.js |
- | static__console.js : 1611 bytes | + | remove: static/favicon.ico |
- | static__favicon.ico : 1078 bytes | + | rename: static__favicon.ico -> static/favicon.ico |
- | static__node.css : 2703 bytes | + | load content file: index.tmpl |
- | static__node.js : 2777 bytes | + | build: static/index.htm |
- | static__svg.js : 2791 bytes | + | load content file: api.tmpl |
- | wifi.tmpl : 779 bytes | + | build: static/api.htm |
- | ---------------------------- | + | load content file: gpio.tmpl |
- | Total file(s) : 21 | + | build: static/gpio.htm |
- | Total size : 29736 bytes | + | load content file: wifi.tmpl |
+ | build: static/wifi.htm | ||
+ | load content file: console.tmpl | ||
+ | build: static/console.htm | ||
+ | load content file: edit.tmpl | ||
+ | build: static/edit.htm | ||
+ | </code> | ||
+ | * Restart nodeMCU with ''RST'' button | ||
+ | * Wait for nodeMCU start up | ||
+ | <code> | ||
+ | NodeMCU 2.0.0 build unspecified powered by Lua 5.1.4 on SDK 2.0.0(656edbf) | ||
- | Total : 3384986 bytes | + | WIFI initialization - mode(STATION) |
- | Used : 38152 bytes | + | |
- | Remain: 3346834 bytes | + | STATION |
+ | WIFI - Connecting to SSID (YOUR_WIFI_SSID)... | ||
+ | Starting Web Server - port: 80 | ||
+ | > IP Info: | ||
+ | IP Address: YOUR-NODEMCU-IP-ADDRESS | ||
+ | Netmask: YOUR-NETWORK-MASK | ||
+ | Gateway Addr: YOUR-NETWORK-GATEWAY | ||
</code> | </code> | ||
- | * Configure script ''ext_wifi_settings.lua'' for WiFi connection strings | + | * Open ''YOUR-NODEMCU-IP-ADDRESS'' in Web browser |
- | * Execute on ESP8266 script ''assemble.lua'' | + | {{ project:wiki_nodemcu_httpd.png }} |
- | * Open http://nodeMCU-IP-Address in Web browser | + | |