├── LICENSE ├── McuNode使用.pdf ├── README.md ├── file-edit.png ├── init.lua └── mcunode release.png /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 IoTServ 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /McuNode使用.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IoTServ/McuNode/5b6a30dc27313ae6f6e8a1480efef5025f6e0fd1/McuNode使用.pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # McuNode   2 | ### Server Side:https://github.com/IoTServ/McuNode-server 3 | ## Cloud service for NodeMcu,you can Terminal online,program online..   4 | ## Edit init.lua file   5 | ### 1):id,set id by yourself ,id string.   6 | ### 2):set ap information on line 25,ap ssid and password. 7 | ### 3) : set ip :A mcunode-server(https://github.com/IoTServ/McuNode-server) IP or Hostname(domain) 8 | ## download file to the nodemcu   9 | ### 3)download the file to nodemcu and reboot it.   10 | ## control online 11 | ### 4)go to your server connect it,and enjoy it!!!   12 | # McuNode 中文使用方法 13 | ## 1.修改init.lua   14 | ## 2.上传这个文件到NodeMcu   15 | ## 3.访问你的NodeMcu-Server网站连接   16 | 17 | ![image](https://raw.githubusercontent.com/IoTServ/McuNode/master/mcunode%20release.png) 18 | -------------------------------------------------------------------------------- /file-edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IoTServ/McuNode/5b6a30dc27313ae6f6e8a1480efef5025f6e0fd1/file-edit.png -------------------------------------------------------------------------------- /init.lua: -------------------------------------------------------------------------------- 1 | id = 'yourid' --Device ID 2 | ssid = 'yourSSID' --WiFi Name 3 | ssidpwd = 'WiFiPassword' --view on http://www.mcunode.com/proxy// like:http://www.mcunode.com/proxy/4567/index.html 4 | ip="yourServerIpOrHostName" --Eg:"192.168.1.105" or“www.mcunode.com” 5 | function ls() 6 | local l = file.list() 7 | for k,v in pairs(l) do 8 | print("name:"..k..", size:"..v) 9 | end 10 | end 11 | function cat(filename) 12 | local line 13 | file.open(filename, "r") 14 | while 1 do 15 | line = file.readline() 16 | if line == nil then 17 | break 18 | end 19 | line = string.gsub(line, "\n", "") 20 | print(line) 21 | end 22 | file.close() 23 | end 24 | function startServer() 25 | print(wifi.sta.getip()) 26 | sk=net.createConnection(net.TCP, 0) 27 | sk:on("receive", function(sck, c) node.input(c) end ) --print(c) 28 | sk:on("connection", function(sck, c) 29 | --print(c) 30 | sk:send(id) 31 | tmr.alarm(2, 30000, 1, function() 32 | sk:send('

') 33 | end) 34 | function s_output(str) 35 | if (sk~=nil and str~='') then 36 | sk:send(str) 37 | end 38 | end 39 | node.output(s_output,1) 40 | end ) 41 | sk:on("disconnection",function(conn,c) 42 | --node.output(nil) 43 | print('reconnect') 44 | sk:connect(8001,ip) 45 | sk:send(id) 46 | end) 47 | sk:connect(8001,ip) 48 | end 49 | wifi.setmode(wifi.STATION) 50 | station_cfg={} 51 | station_cfg.ssid=ssid 52 | station_cfg.pwd=pwd 53 | station_cfg.save=false 54 | station_cfg.auto=true 55 | wifi.sta.config(station_cfg) --set your ap info !!!!!! 56 | wifi.sta.autoconnect(1) 57 | tmr.alarm(1, 1000, 1, function() 58 | if wifi.sta.getip()==nil then 59 | print("Connect AP, Waiting...") 60 | else 61 | startServer() 62 | tmr.stop(1) 63 | end 64 | end) 65 | -------------------------------------------------------------------------------- /mcunode release.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IoTServ/McuNode/5b6a30dc27313ae6f6e8a1480efef5025f6e0fd1/mcunode release.png --------------------------------------------------------------------------------