nodemcu

The wifi.sta module connects if a loop is running?

微笑、不失礼 提交于 2019-12-02 08:02:22
Im trying to detect when the module actually connects to my wifi AP, since .connect does not have a callback im doing something simple like this: wifi.sta.config("SSID","password") wifi.sta.connect() tmr.delay(1000000) i = 0 while(wifi.sta.status() ~= 5 and i < 10) do print("Waiting") print(wifi.sta.status()) i = i + 1 tmr.delay(1000000) end But the output of .sta.status() is always 1 inside the loop. When it finish, if I send the command =wifi.sta.status() manually from the IDE it tells me 5. Why? Using tmr.delay doesnot let run the event loop, you should use a timer callback. Then the code

Unable to connect NodeMCU with Firebase as console shows setting /number failed: each time

偶尔善良 提交于 2019-12-01 11:18:34
问题 Unable to connect NodeMCU with Firebase as console shows setting /number failed: each time No updation on firebase as well. or should I change the cloud server? #include <ESP8266WiFi.h> #include <FirebaseArduino.h> // Set these to run example. #define FIREBASE_HOST "example.firebaseio.com" #define FIREBASE_AUTH "token_or_secret" #define WIFI_SSID "SSID" #define WIFI_PASSWORD "PASSWORD" void setup() { Serial.begin(9600); // connect to wifi. WiFi.begin(WIFI_SSID, WIFI_PASSWORD); Serial.print(

ESP8622 with NodeMCU firmware starts blinking after flashing new version of firmware (old builds are working)

狂风中的少年 提交于 2019-12-01 08:44:26
Yesterday i tried to generate new firmware bin from nodemcu-build.com and after flashing with esptool.py, my esp started blinking (blue diode on esp chip) and sending out (trough USB converter) garbage data. I tried to generate build with combination of modules, tried to flash them (binary and float) and it always start blinking and sending out garbage. Than my co-worker tried his older build and everything worked perfectly, than he send me his older build and after flashing everything works also perfectly. So there is no problem with flashing tool or system (tested on both mac and linux) and

HTTPS (SSL) get request with NodeMCU

非 Y 不嫁゛ 提交于 2019-12-01 08:07:45
问题 I would like to perform GET requests to googleapi.com with my ESP8266 running NodeMCU, to get some data from the google Calendar API. The website allows only secured connection (HTTPS/SSL). First, I've been trying to connect to google.com (secured) to give it a try, but with no success either. Here is the LUA code: conn=net.createConnection(net.TCP, 1) conn:on("receive", function(sck, c) print(c) end ) conn:on("connection", function(conn) print("connected") conn:send("HEAD / HTTP/1.1\r\n"..

ESP8622 with NodeMCU firmware starts blinking after flashing new version of firmware (old builds are working)

不打扰是莪最后的温柔 提交于 2019-12-01 06:38:58
问题 Yesterday i tried to generate new firmware bin from nodemcu-build.com and after flashing with esptool.py, my esp started blinking (blue diode on esp chip) and sending out (trough USB converter) garbage data. I tried to generate build with combination of modules, tried to flash them (binary and float) and it always start blinking and sending out garbage. Than my co-worker tried his older build and everything worked perfectly, than he send me his older build and after flashing everything works

nodemcu固件的烧录及lua开发

微笑、不失礼 提交于 2019-11-30 22:08:21
一、板子介绍 NodeMCU 1.0/ESP 8266 12E 该模块是安信可公司生产的,并且提供全部开发资料。 对该模块的开发有两种方式: 一种是基于乐鑫官方推出的SDK开发包在 安信可ESP的一体化开发环境进行开发,使用AT指令,编译生成固件直接烧写入模块当中,开发可参照安信可官方提供的开发者资料 http://wiki.ai-thinker.com/esp8266 ; 另一种 就是基于NodeMCU的Lua脚本化编程,该种方式是首先在模块中烧入NodeMCU固件,在此基础之上利用类似于Node.js脚本语言来对硬件进行操作。 下面介绍第二种。 二、烧录固件 下载固件 填写邮箱(邮箱的作用是将定制好的bin文件发到你的邮箱) 注意:这里的邮箱貌似不能使用qq邮箱,可以使用新浪 或者微软的OutLook,或者gmail. 选择需要的组件,不需要全选,一般了默认的就好。 再点击尾部的start your build, 几分钟后会受到两份邮件,第一份通知固件开始构建,然后再等几分钟回收到一份带有固件下载链接的邮件。 邮件内包含两个下载链接对应两类固件,float比integer多几十K,想节省一些内存就选择integer下载吧 ! 开始烧录 用到的工具可见 链接 其中箭头上根据自己的nodemcu型号调整 波特率尝试115200或者9600 注意烧录固件的时候 要将GPIO0引脚拉低

Quick Start NodeMCU / ESP8266 12E

落花浮王杯 提交于 2019-11-30 19:31:35
先说明一下:本来想买常见的ESP 8266作为Arduinoi的WIFI模块,结果错买成ESP 8266 12E,发现网上的资料比较少。 ESP8266是WIFI芯片,它只是一块芯片必须要搭配相应的电路,而ESP12E是使用ESP8266做的WiFi模块,它有外置的flash以及PCB板载天线。12e出场自带了最新的安信可AT固件 NodeMcu是基于ESP8266-12E的一款硬件,编程语言使用lua脚本 一、连接到电脑 使用Micro USB线将MCU与电脑连接 二、配置附加开发板 1、打开Arduino,选择“首选项”,在“附加开发板管理器网址”中填入http://arduino.esp8266.com/stable/package_esp8266com_index.json,然后点击确定保存这个地址。 2、打开工具->开发板->开发板管理器 搜索8266,点击安装(源码在github上,可能比较慢) 3、选择NodeMCU 1.0作为开发板 三、运行示例程序 示例1 点击示例->ESP8266->Blink 使用D7引脚, void setup() { pinMode(D7, OUTPUT); // Initialize the LED_BUILTIN pin as an output } // the loop function runs over and over

How to send multiple data (conn:send()) with the new SDK (NodeMCU)

只谈情不闲聊 提交于 2019-11-30 16:06:18
I've been reading the NodeMCU documentation and several closed issues about the change of SDK that previouly allowed to send multiple data streams (acting like a queued net.socket:send). It seems a huge debate grew here ( #730 ) and there ( #993 ) or even here ( #999 ). However, I did not find any convincing example of a webserver code that would allow me to read multiple html files (e.g. head.html and body.html ) to display a page. Here's the example from TerryE that I tried to adapt, but with no success: srv=net.createServer(net.TCP) srv:listen(80,function(conn) conn:on ("receive", function

How to send multiple data (conn:send()) with the new SDK (NodeMCU)

断了今生、忘了曾经 提交于 2019-11-29 23:02:52
问题 I've been reading the NodeMCU documentation and several closed issues about the change of SDK that previouly allowed to send multiple data streams (acting like a queued net.socket:send). It seems a huge debate grew here (#730) and there (#993) or even here (#999). However, I did not find any convincing example of a webserver code that would allow me to read multiple html files (e.g. head.html and body.html ) to display a page. Here's the example from TerryE that I tried to adapt, but with no

ESP8266 NodeMCU Running Out of Heap Memory

时光怂恿深爱的人放手 提交于 2019-11-26 09:58:13
问题 I am trying to toggle an LED using ESP8266-01 by sending POST from my laptop (using node.js) I now have a memory issue because whenever I send POST request, the memory used in the ESP increases, and heap memory decreases, and it crashes (restart) when theres no memory left. any thoughts? Here is my code on the ESP side (main.lua): gpio.mode(3, gpio.OUTPUT) srv=net.createServer(net.TCP,28800) print(\"Server created... \\n\") local pinState=0 srv:listen(80,function(conn) conn:on(\"receive\",