匿名
尚未登入
登入
flip the world
搜尋
檢視ESP8266, Wi-Fi SoC的原始碼
出自flip the world
命名空間
頁面
討論
更多
更多
頁面操作
閱讀
檢視原始碼
歷史
←
ESP8266, Wi-Fi SoC
您沒有權限執行編輯此頁面,由於以下原因:
您請求的操作只有這個群組的使用者能使用:
使用者
您可以檢視並複製此頁面的原始碼。
[[File:Esp8266 nodemcu.jpg|thumb|300px|ESP8266 NodeMCU]] == Pin definition == [[File:Esp8266 Pinout.png| ESP8266 pin definition]] == Pre-build firmware == * Download ** git clone https://github.com/nodemcu/nodemcu-firmware/releases == NodeMCU flasher == <pre> NodeMCU flasher is a firmware programmer for NodeMCU DEVKIT V0.9. You can use it to program NodeMCU DEVKIT or your own ESP8266 board. You MUST set GPIO0 to LOW before programming, and NodeMCU DEVKIT V0.9 will do it automatically. </pre> [[File:ESP8266Flasher_1.png|250px|ESP8266Flasher_1]][[File:ESP8266Flasher_2.png|250px|ESP8266Flasher_2]][[File:ESP8266Flasher_3.png|250px|ESP8266Flasher_3]][[File:ESP8266Flasher_4.png|250px|ESP8266Flasher_4]][[File:ESP8266Flasher_5.png|250px|ESP8266Flasher_5]] * Download ** git clone https://github.com/nodemcu/nodemcu-flasher ** Choice the Win32 / Win64 against your environment * Prepare & running ** So far, it seems like only can flash success in Windows environment == ESPlorer == [[File:Esplorer.jpg|500px|Esplorer]] * Download ** http://esp8266.ru/esplorer/#download * Build from source <pre> 1. Install Netbeans 8.1, download from here. I used the "All", but I think Java SE should be enough. 2. Install JDK 1.7 (I wasn't able to use JDK 1.8), download from here. 3. Download rsyntaxtextarea 2.5.6.jar (I wasn't able to use any other version) from here, put it somewhere and remember where (e.g.: inside the ESPlorer root dir) 4. Open the project.properties file in a texteditor, and edit file.reference.rsyntaxtextarea-2.5.6.jar to point to where you put rsyntaxtextarea 2.5.6.jar 5. Open netbeans 6. Open the ESPlorer project, you should get an error about the JDK platform 7. Click resolve, add platform 8. Add the JDK 1.7 dir, and where it says Name you should see "JDK 1.7", rename that to "JDK1.7" (notice the lack of a space), close the dialog 9 press F11 to build 9. The ESPLorer .jar should be under the dist subdir </pre> * Prepare & running ** Install java ** java -jar EXPlorer.jar == Breathing LED == <pre> pwm.setup(2, 500, 512) pwm.start(2) pwm.setduty(2, 0) i = 0 while true do while i < 512 do pwm.setduty(2, i) i=i+5 tmr.delay(20000) end tmr.delay(100000) while i > 0 do pwm.setduty(2, i) i=i-5 tmr.delay(20000) end tmr.delay(50000) end </pre> == httpserver to control GPIO == * Lua script ( <span style="color:#ff0000">wifi.sta.config SHOULD provide real AP information</span>) <pre> wifi.setmode(wifi.STATION) wifi.sta.config("YOUR_NETWORK_NAME","YOUR_NETWORK_PASSWORD") print(wifi.sta.getip()) led1 = 3 led2 = 4 gpio.mode(led1, gpio.OUTPUT) gpio.mode(led2, gpio.OUTPUT) srv=net.createServer(net.TCP) srv:listen(80,function(conn) conn:on("receive", function(client,request) local buf = ""; local _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP"); if(method == nil)then _, _, method, path = string.find(request, "([A-Z]+) (.+) HTTP"); end local _GET = {} if (vars ~= nil)then for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do _GET[k] = v end end buf = buf.."<h1> ESP8266 Web Server</h1>"; buf = buf.."<p>GPIO0 <a href=\"?pin=ON1\"><button>ON</button></a> <a href=\"?pin=OFF1\"><button>OFF</button></a></p>"; buf = buf.."<p>GPIO2 <a href=\"?pin=ON2\"><button>ON</button></a> <a href=\"?pin=OFF2\"><button>OFF</button></a></p>"; local _on,_off = "","" if(_GET.pin == "ON1")then gpio.write(led1, gpio.HIGH); elseif(_GET.pin == "OFF1")then gpio.write(led1, gpio.LOW); elseif(_GET.pin == "ON2")then gpio.write(led2, gpio.HIGH); elseif(_GET.pin == "OFF2")then gpio.write(led2, gpio.LOW); end client:send(buf); client:close(); collectgarbage(); end) end) </pre> * Accessing your web server <pre> When your ESP8266 restarts it prints in your serial monitor the IP address of your ESP8266. If you type your ESP8266 IP address in your web browser, you can access your web server. In my case it’s http://192.168.1.8. </pre> [[File:Esp8266_httpserver.png|250px| http server for GPIO control ]] == Using Arduino IDE as ESP8266 development tool == * Download the Arduino IDE 1.8.2 above * Go to File --> Preferences and add the link http://arduino.esp8266.com/stable/package_esp8266com_index.json to the Additional Boards Manager URLS. * Go to Tools --> Board --> Boards manager * You should now have the esp8266 as an option there since you've added it to the Additional Boards. Select it and press Install * Wait, and then, .... * Now, You have the ESP8266 boards configure. Choose the board you have, "Generic ESP8266 Module" if you got the regular module == [[application - wifi node (Alexa / IFTTT)]] == == Reference == * [https://zh.wikipedia.org/zh-tw/NodeMCU, wiki - NodeMCU] * [http://nodemcu.com/index_en.html, NodeMCU] * [https://github.com/nodemcu/nodemcu-flasher, NMCU flasher] * [http://www.esp8266.com/viewtopic.php?f=22&t=882, ESPlorer] * [https://github.com/devyte/nodemcu-platform/wiki/How-to-build-ESPlorer-from-sources, How-to-build-ESPlorer-from-sources] * [http://randomnerdtutorials.com/esp8266-web-server/, ESP8266 Web Server Tutorial] * [http://www.whatimade.today/esp8266-easiest-way-to-program-so-far/, ESP8266 - Easiest way to program so far (Using Arduino IDE)] [[Category:Boards and SoCs]]
返回到「
ESP8266, Wi-Fi SoC
」。
導覽
導覽
首頁
近期變更
隨機頁面
MediaWiki說明
wiki工具
wiki工具
特殊頁面
頁面工具
頁面工具
使用者頁面工具
更多
連結至此的頁面
相關變更
頁面資訊
頁面日誌