Advertisement
vascon21

Untitled

Apr 4th, 2017
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 15.08 KB | None | 0 0
  1.  
  2. PORT OPEN 9600
  3. =node.heap()
  4. =node.heap()
  5. 21888
  6. > file.remove("script1.lua");
  7. file.open("script1.lua","w+");
  8. w = fi> iFi_24","13551369")]==]);
  9. w([==[print(wifi.sta.getip())]==]);
  10. w([==[led1 = 3]==]);
  11. w([==[led2 = 4]==]);
  12. w([==[gpio.mode(led1, gpio.OUTPUT)]==]);
  13. w([==[gpio.mode(led2, gpio.OUTPUT)]==]);
  14. w([==[srv=net.createServer(net.TCP)]==]);
  15. w([==[srv:listen(80,function(conn)]==]);
  16. w([==[    conn:on("receive", function(client,request)]==]);
  17. w([==[        local buf = "";]==]);
  18. w([==[        local _, _, method, path, vars = string.find(request, "(\[A-Z]+) (.+)?(.+) HTTP");]==]);
  19. w([==[        if(method == nil)then]==]);
  20. w([==[            _, _, method, path = string.find(request, "(\[A-Z]+) (.+) HTTP");]==]);
  21. w([==[        end]==]);
  22. w([==[        local _GET = {}]==]);
  23. w([==[        if (vars ~= nil)then]==]);
  24. w([==[            for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do]==]);
  25. w([==[                _GET[k] = v]==]);
  26. w([==[            end]==]);
  27. w([==[        end]==]);
  28. w([==[        buf = buf.."<h1> ESP8266 Web Server</h1>";]==]);
  29. w([==[        buf = buf.."<p>GPIO0 <a href=\"?pin=ON1\"><button>ON</button></a>&nbsp;<a href=\"?pin=OFF1\"><button>OFF</button></a></p>";]==]);
  30. w([==[        buf = buf.."<p>GPIO2 <a href=\"?pin=ON2\"><button>ON</button></a>&nbsp;<a href=\"?pin=OFF2\"><button>OFF</button></a></p>";]==]);
  31. w([==[        local _on,_off = "",""]==]);
  32. w([==[        if(_GET.pin == "ON1")then]==]);
  33. w([==[              gpio.write(led1, gpio.HIGH);]==]);
  34. w([==[        elseif(_GET.pin == "OFF1")then]==]);
  35. w([==[              gpio.write(led1, gpio.LOW);]==]);
  36. w([==[        elseif(_GET.pin == "ON2")then]==]);
  37. w([==[              gpio.write(led2, gpio.HIGH);]==]);
  38. w([==[        elseif(_GET.pin == "OFF2")then]==]);
  39. w([==[              gpio.write(led2, gpio.LOW);]==]);
  40. w([==[        end]==]);
  41. w([==[        client:send(buf);]==]);
  42. w([==[        client:close();]==]);
  43. w([==[        collectgarbage();]==]);
  44. w([==[    end)]==]);
  45. w([==[end)]==]);
  46. file.close();
  47. dofile("script1.lua");
  48. stdin:1: '<eof>' expected near 'end'
  49. >
  50. Total : 549941 bytes
  51. Used  : 251 bytes
  52. Remain: 549690 bytes
  53.  
  54. >
  55. file.remove("script1.lua");
  56. file.remove("script1.lua");
  57. >
  58. Total : 549941 bytes
  59. Used  : 0 bytes
  60. Remain: 549941 bytes
  61.  
  62. > file.remove("script1.lua");
  63. f>> ile.open("script1.lua","w+");
  64. w = file.writeline
  65. w([==[wifi.setmode(wifi.STATION)]==]);
  66. w([==[wifi.sta.config("Vascon_WiFi_24","13551369")]==]);
  67. w([==[print(wifi.sta.getip())]==]);
  68. w([==[led1 = 3]==]);
  69. w([==[led2 = 4]==]);
  70. w([==[gpio.mode(led1, gpio.OUTPUT)]==]);
  71. w([==[gpio.mode(led2, gpio.OUTPUT)]==]);
  72. w([==[srv=net.createServer(net.TCP)]==]);
  73. w([==[srv:listen(80,function(conn)]==]);
  74. w([==[    conn:on("receive", function(client,request)]==]);
  75. w([==[        local buf = "";]==]);
  76. w([==[        local _, _, method, path, vars = string.find(request, "(\[A-Z]+) (.+)?(.+) HTTP");]==]);
  77. w([==[        if(method == nil)then]==]);
  78. w([==[            _, _, method, path = string.find(request, "(\[A-Z]+) (.+) HTTP");]==]);
  79. w([==[        end]==]);
  80. w([==[        local _GET = {}]==]);
  81. w([==[        if (vars ~= nil)then]==]);
  82. w([==[            for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do]==]);
  83. w([==[                _GET[k] = v]==]);
  84. w([==[            end]==]);
  85. w([==[        end]==]);
  86. w([==[        buf = buf.."<h1> ESP8266 Web Server</h1>";]==]);
  87. w([==[        buf = buf.."<p>GPIO0 <a href=\"?pin=ON1\"><button>ON</button></a>&nbsp;<a href=\"?pin=OFF1\"><button>OFF</button></a></p>";]==]);
  88. w([==[        buf = buf.."<p>GPIO2 <a href=\"?pin=ON2\"><button>ON</button></a>&nbsp;<a href=\"?pin=OFF2\"><button>OFF</button></a></p>";]==]);
  89. w([==[        local _on,_off = "",""]==]);
  90. w([==[        if(_GET.pin == "ON1")then]==]);
  91. w([==[              gpio.write(led1, gpio.HIGH);]==]);
  92. w([==[        elseif(_GET.pin == "OFF1")then]==]);
  93. w([==[              gpio.write(led1, gpio.LOW);]==]);
  94. w([==[        elseif(_GET.pin == "ON2")then]==]);
  95. w([==[              gpio.write(led2, gpio.HIGH);]==]);
  96. w([==[        elseif(_GET.pin == "OFF2")then]==]);
  97. w([==[              gpio.write(ledrЇ„Fк ¦фD‹МьЊ¦„ОЊ¦ш
  98.  
  99. NodeMCU 0.9.5 build 20150318  powered by Lua 5.1.4
  100. lua: cannot open init.lua
  101. >
  102. Total : 549941 bytes
  103. Used  : 0 bytes
  104. Remain: 549941 bytes
  105.  
  106. > file.remove("script1.lua");
  107. file.open("script1.lua","w+");
  108. w = fil> WiFi_24","13551369")]==]);
  109. w([==[print(wifi.sta.getip())]==]);
  110. w([==[led1 = 3]==]);
  111. w([==[led2 = 4]==]);
  112. w([==[gpio.mode(led1, gpio.OUTPUT)]==]);
  113. w([==[gpio.mode(led2, gpio.OUTPUT)]==]);
  114. w([==[srv=net.createServer(net.TCP)]==]);
  115. w([==[srv:listen(80,function(conn)]==]);
  116. w([==[    conn:on("receive", function(client,request)]==]);
  117. w([==[        local buf = "";]==]);
  118. w([==[        local _, _, method, path, vars = string.find(request, "(\[A-Z]+) (.+)?(.+) HTTP");]==]);
  119. w([==[        if(method == nil)then]==]);
  120. w([==[            _, _, method, path = string.find(request, "(\[A-Z]+) (.+) HTTP");]==]);
  121. w([==[        end]==]);
  122. w([==[        local _GET = {}]==]);
  123. w([==[        if (vars ~= nil)then]==]);
  124. w([==[            for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do]==]);
  125. w([==[                _GET[k] = v]==]);
  126. w([==[            end]==]);
  127. w([==[        end]==]);
  128. w([==[        buf = buf.."<h1> ESP8266 Web Server</h1>";]==]);
  129. w([==[        buf = buf.."<p>GPIO0 <a href=\"?pin=ON1\"><button>ON</button></a>&nbsp;<a href=\"?pin=OFF1\"><button>OFF</button></a></p>";]==]);
  130. w([==[        buf = buf.."<p>GPIO2 <a href=\"?pin=ON2\"><button>ON</button></a>&nbsp;<a href=\"?pin=OFF2\"><button>OFF</button></a></p>";]==]);
  131. w([==[        local _on,_off = "",""]==]);
  132. w([==[        if(_GET.pin == "ON1")then]==]);
  133. w([==[              gpio.write(led1, gpio.HIGH);]==]);
  134. w([==[        elseif(_GET.pin == "OFF1")then]==]);
  135. w([==[              gpio.write(led1, gpio.LOW);]==]);
  136. w([==[        elseif(_GET.pin == "ON2")then]==]);
  137. w([==[              gpio.write(led2, gpio.HIGH);]==]);
  138. w([==[        elseif(_GET.pin == "OFF2")then]==]);
  139. w([==[              gpio.write(led2, gpio.LOW);]==]);
  140. w([==[        end]==]);
  141. w([==[        client:send(buf);]==]);
  142. w([==[        client:close();]==]);
  143. w([==[        collectgarbage();]==]);
  144. w([==[    end)]==]);
  145. w([==[end)]==]);
  146. file.close();
  147. dofile("script1.lua");
  148. stdin:1: unexpected symbol near '['
  149. >
  150. Total : 549941 bytes
  151. Used  : 251 bytes
  152. Remain: 549690 bytes
  153.  
  154. >
  155. file.remove("script1.lua");
  156. file.remove("script1.lua");
  157. >
  158. Total : 549941 bytes
  159. Used  : 0 bytes
  160. Remain: 549941 bytes
  161.  
  162. > file.remove("script1.lua");
  163. file.open("script1.lua","w+");
  164. w >> = file.writeline
  165. w([==[wifi.setmode(wifi.STATION)]==]);
  166. w([==[wifi.sta.config("Vascon_WiFi_24","13551369")]==]);
  167. w([==[print(wifi.sta.getip())]==]);
  168. w([==[led1 = 3]==]);
  169. w([==[led2 = 4]==]);
  170. w([==[gpio.mode(led1, gpio.OUTPUT)]==]);
  171. w([==[gpio.mode(led2, gpio.OUTPUT)]==]);
  172. w([==[srv=net.createServer(net.TCP)]==]);
  173. w([==[srv:listen(80,function(conn)]==]);
  174. w([==[    conn:on("receive", function(client,request)]==]);
  175. w([==[        local buf = "";]==]);
  176. w([==[        local _, _, method, path, vars = string.find(request, "(\[A-Z]+) (.+)?(.+) HTTP");]==]);
  177. w([==[        if(method == nil)then]==]);
  178. w([==[            _, _, method, path = string.find(request, "(\[A-Z]+) (.+) HTTP");]==]);
  179. w([==[        end]==]);
  180. w([==[        local _GET = {}]==]);
  181. w([==[        if (vars ~= nil)then]==]);
  182. w([==[            for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do]==]);
  183. w([==[                _GET[k] = v]==]);
  184. w([==[            end]==]);
  185. w([==[        end]==]);
  186. w([==[        buf = buf.."<h1> ESP8266 Web Server</h1>";]==]);
  187. w([==[        buf = buf.."<p>GPIO0 <a href=\"?pin=ON1\"><button>ON</button></a>&nbsp;<a href=\"?pin=OFF1\"><button>OFF</button></a></p>";]==]);
  188. w([==[        buf = buf.."<p>GPIO2 <a href=\"?pin=ON2\"><button>ON</button></a>&nbsp;<a href=\"?pin=OFF2\"><button>OFF</button></a></p>";]==]);
  189. w([==[        local _on,_off = "",""]==]);
  190. w([==[        if(_GET.pin == "ON1")then]==]);
  191. w([==[              gpio.write(led1, gpio.HIGH);]==]);
  192. w([==[        elseif(_GET.pin == "OFF1")then]==]);
  193. w([==[              gpio.write(led1, gpio.LOW);]==]);
  194. w([==[        elseif(_GET.pin == "ON2")then]==]);
  195. w([==[              gpio.write(led2, gpio.HIGH);]==]);
  196. w([==[        elseif(_GET.pin == "OFF2")then]==]);
  197. w([==[              gpio.write(led2, gpio.LOW);]==]);
  198. w([==[        end]==]);
  199. w([==[        client:send(buf);]==]);
  200. w([==[        client:close();]==]);
  201. w([==[        collectgarbage();]==]);
  202. w([==[    end)]==]);
  203. w([==[end)]==]);
  204. file.close();
  205. dofile("script1.lua");
  206. stdin:2: '=' expected near ';'
  207. >
  208. file.remove("script1.lua");
  209. file.remove("script1.lua");
  210. >
  211. Total : 549941 bytes
  212. Used  : 0 bytes
  213. Remain: 549941 bytes
  214.  
  215. > file.remove("script1.lua");
  216. file.open("script1.lua","w+");
  217. w = file> iFi_24","13551369")]==]);
  218. w([==[print(wifi.sta.getip())]==]);
  219. w([==[led1 = 3]==]);
  220. w([==[led2 = 4]==]);
  221. w([==[gpio.mode(led1, gpio.OUTPUT)]==]);
  222. w([==[gpio.mode(led2, gpio.OUTPUT)]==]);
  223. w([==[srv=net.createServer(net.TCP)]==]);
  224. w([==[srv:listen(80,function(conn)]==]);
  225. w([==[    conn:on("receive", function(client,request)]==]);
  226. w([==[        local buf = "";]==]);
  227. w([==[        local _, _, method, path, vars = string.find(request, "(\[A-Z]+) (.+)?(.+) HTTP");]==]);
  228. w([==[        if(method == nil)then]==]);
  229. w([==[            _, _, method, path = string.find(request, "(\[A-Z]+) (.+) HTTP");]==]);
  230. w([==[        end]==]);
  231. w([==[        local _GET = {}]==]);
  232. w([==[        if (vars ~= nil)then]==]);
  233. w([==[            for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do]==]);
  234. w([==[                _GET[k] = v]==]);
  235. w([==[            end]==]);
  236. w([==[        end]==]);
  237. w([==[        buf = buf.."<h1> ESP8266 Web Server</h1>";]==]);
  238. w([==[        buf = buf.."<p>GPIO0 <a href=\"?pin=ON1\"><button>ON</button></a>&nbsp;<a href=\"?pin=OFF1\"><button>OFF</button></a></p>";]==]);
  239. w([==[        buf = buf.."<p>GPIO2 <a href=\"?pin=ON2\"><button>ON</button></a>&nbsp;<a href=\"?pin=OFF2\"><button>OFF</button></a></p>";]==]);
  240. w([==[        local _on,_off = "",""]==]);
  241. w([==[        if(_GET.pin == "ON1")then]==]);
  242. w([==[              gpio.write(led1, gpio.HIGH);]==]);
  243. w([==[        elseif(_GET.pin == "OFF1")then]==]);
  244. w([==[              gpio.write(led1, gpio.LOW);]==]);
  245. w([==[        elseif(_GET.pin == "ON2")then]==]);
  246. w([==[              gpio.write(led2, gpio.HIGH);]==]);
  247. w([==[        elseif(_GET.pin == "OFF2")then]==]);
  248. w([==[              gpio.write(led2, gpio.LOW);]==]);
  249. w([==[        end]==]);
  250. w([==[        client:send(buf);]==]);
  251. w([==[        client:close();]==]);
  252. w([==[        collectgarbage();]==]);
  253. w([==[    end)]==]);
  254. w([==[end)]==]);
  255. file.close();
  256. dofile("script1.lua");
  257. stdin:1: '<eof>' expected near 'end'
  258. >
  259. Total : 549941 bytes
  260. Used  : 251 bytes
  261. Remain: 549690 bytes
  262.  
  263. >
  264. file.remove("script1.lua");
  265. file.remove("script1.lua");
  266. >
  267. Total : 549941 bytes
  268. Used  : 0 bytes
  269. Remain: 549941 bytes
  270.  
  271. > file.remove("script1.lua");
  272. file.open("script1.lua","w+");
  273. > "Vascon_WiFi_24","13551369")]==]);
  274. w([==[print(wifi.sta.getip())]==]);
  275. w([==[led1 = 3]==]);
  276. w([==[led2 = 4]==]);
  277. w([==[gpio.mode(led1, gpio.OUTPUT)]==]);
  278. w([==[gpio.mode(led2, gpio.OUTPUT)]==]);
  279. w([==[srv=net.createServer(net.TCP)]==]);
  280. w([==[srv:listen(80,function(conn)]==]);
  281. w([==[    conn:on("receive", function(client,request)]==]);
  282. w([==[        local buf = "";]==]);
  283. w([==[        local _, _, method, path, vars = string.find(request, "(\[A-Z]+) (.+)?(.+) HTTP");]==]);
  284. w([==[        if(method == nil)then]==]);
  285. w([==[            _, _, method, path = string.find(request, "(\[A-Z]+) (.+) HTTP");]==]);
  286. w([==[        end]==]);
  287. w([==[        local _GET = {}]==]);
  288. w([==[        if (vars ~= nil)then]==]);
  289. w([==[            for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do]==]);
  290. w([==[                _GET[k] = v]==]);
  291. w([==[            end]==]);
  292. w([==[        end]==]);
  293. w([==[        buf = buf.."<h1> ESP8266 Web Server</h1>";]==]);
  294. w([==[        buf = buf.."<p>GPIO0 <a href=\"?pin=ON1\"><button>ON</button></a>&nbsp;<a href=\"?pin=OFF1\"><button>OFF</button></a></p>";]==]);
  295. w([==[        buf = buf.."<p>GPIO2 <a href=\"?pin=ON2\"><button>ON</button></a>&nbsp;<a href=\"?pin=OFF2\"><button>OFF</button></a></p>";]==]);
  296. w([==[        local _on,_off = "",""]==]);
  297. w([==[        if(_GET.pin == "ON1")then]==]);
  298. w([==[              gpio.write(led1, gpio.HIGH);]==]);
  299. w([==[        elseif(_GET.pin == "OFF1")then]==]);
  300. w([==[              gpio.write(led1, gpio.LOW);]==]);
  301. w([==[        elseif(_GET.pin == "ON2")then]==]);
  302. w([==[              gpio.write(led2, gpio.HIGH);]==]);
  303. w([==[        elseif(_GET.pin == "OFF2")then]==]);
  304. w([==[              gpio.write(led2, gpio.LOW);]==]);
  305. w([==[        end]==]);
  306. w([==[        client:send(buf);]==]);
  307. w([==[        client:close();]==]);
  308. w([==[        collectgarbage();]==]);
  309. w([==[    end)]==]);
  310. w([==[end)]==]);
  311. file.close();
  312. dofile("script1.lua");
  313. stdin:1: unexpected symbol near ']'
  314. >
  315. Total : 549941 bytes
  316. Used  : 251 bytes
  317. Remain: 549690 bytes
  318.  
  319. >
  320. file.remove("script1.lua");
  321. file.remove("script1.lua");
  322. >
  323. Total : 549941 bytes
  324. Used  : 0 bytes
  325. Remain: 549941 bytes
  326.  
  327. > file.remove("script1.lua");
  328. file.open("script1.lua","w+");
  329. w = file.writeline
  330. w([==[wifi.set>> mode(wifi.STATION)]==]);
  331. w([==[wifi.sta.config("Vascon_WiFi_24","13551369")]==]);
  332. w([==[print(wifi.sta.getip())]==]);
  333. w([==[led1 = 3]==]);
  334. w([==[led2 = 4]==]);
  335. w([==[gpio.mode(led1, gpio.OUTPUT)]==]);
  336. w([==[gpio.mode(led2, gpio.OUTPUT)]==]);
  337. w([==[srv=net.createServer(net.TCP)]==]);
  338. w([==[srv:listen(80,function(conn)]==]);
  339. w([==[    conn:on("receive", function(client,request)]==]);
  340. w([==[        local buf = "";]==]);
  341. w([==[        local _, _, method, path, vars = string.find(request, "(\[A-Z]+) (.+)?(.+) HTTP");]==]);
  342. w([==[        if(method == nil)then]==]);
  343. w([==[            _, _, method, path = string.find(request, "(\[A-Z]+) (.+) HTTP");]==]);
  344. w([==[        end]==]);
  345. w([==[        local _GET = {}]==]);
  346. w([==[        if (vars ~= nil)then]==]);
  347. w([==[            for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do]==]);
  348. w([==[                _GET[k] = v]==]);
  349. w([==[            end]==]);
  350. w([==[        end]==]);
  351. w([==[        buf = buf.."<h1> ESP8266 Web Server</h1>";]==]);
  352. w([==[        buf = buf.."<p>GPIO0 <a href=\"?pin=ON1\"><button>ON</button></a>&nbsp;<a href=\"?pin=OFF1\"><button>OFF</button></a></p>";]==]);
  353. w([==[        buf = buf.."<p>GPIO2 <a href=\"?pin=ON2\"><button>ON</button></a>&nbsp;<a href=\"?pin=OFF2\"><button>OFF</button></a></p>";]==]);
  354. w([==[        local _on,_off = "",""]==]);
  355. w([==[        if(_GET.pin == "ON1")then]==]);
  356. w([==[              gpio.write(led1, gpio.HIGH);]==]);
  357. w([==[        elseif(_GET.pin == "OFF1")then]==]);
  358. w([==[              gpio.write(led1, gpio.LOW);]==]);
  359. w([==[        elseif(_GET.pin == "ON2")then]==]);
  360. w([==[              gpio.write(led2, gpio.HIGH);]==]);
  361. w([==[        elseif(_GET.pin == "OFF2")then]==]);
  362. w([==[              gpio.write(led2, gpio.LOW);]==]);
  363. w([==[        end]==]);
  364. w([==[        client:send(buf);]==]);
  365. w([==[        client:close();]==]);
  366. w([==[        collectgarbage();]==]);
  367. w([==[    end)]==]);
  368. w([==[end)]==]);
  369. file.close();
  370. dofile("script1.lua");
  371. stdin:1: attempt to call field 'writelinew' (a nil value)
  372. >
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement