esp8266

MQTT on ESP8266 with NodeMCU - problems with publishing

你。 提交于 2019-12-12 02:56:57
问题 I'm building a battery powered IoT device based on ESP8266 with NodeMCU. I use mqtt to periodically perform measurements and publish results. I know, that to allow network stack running, I should avoid tight loops and rely on callback functions. Therefore it seemed to me that the right organization of my measurement code should be: interval=60000000 function sleep_till_next_sample() node.dsleep(interval) end function close_after_sending() m:close() sleep_till_next_sample() end function

Arduino mega + esp 8266 sending get request

别来无恙 提交于 2019-12-12 02:43:16
问题 i have a php script which help to store data into google firebase. i am using this url to access my php scipt and input the data: arduino.byethost22.com/FirebaseTest.php?slot1_data=empty&slot2_data=occupied i have tried it and it is able to store slot1_data as empty and slot2_data as occupied. However i need to use arduino to send this url. i am using this code currently #include "SoftwareSerial.h" #define DEBUG false // turn debug message on or off in serial String server = "arduino

PANIC: unprotected error in call to Lua API (wificonfig.lua:33: address in use)

China☆狼群 提交于 2019-12-12 01:52:21
问题 I'm trying to create a local http server on ESP8266 with lua using NodeMCU custom build by frightanic.com. When i create a local http server along with a connection that is already listening on port 80 and fetching data from my server site, it is giving me PANIC error. Here's my code : wifi.setmode(wifi.STATION) wifi.sta.config("SSID","password") wifi.sta.connect() tmr.alarm(1,10000, 1, function() if (wifi.sta.getip() == nil) then print("IP unavaiable, Waiting...") else foo() local_server()

【零知ESP8266教程】进阶篇3 SSDP简单服务发现协议​

心不动则不痛 提交于 2019-12-11 17:51:26
1、概述 SSDP简单服务发现协议,它是UPnP的核心协议之一。UPnP是零配置网络协议的一种。大众使用的家庭设备一般都支持这个协议,以便用户的主机或手机能够轻松发现这些设备。当一个新的设备(比如说笔记本)加入到网络中时,它可以向本地网络查询特定设备是否存在,这些设备包括互联网网关、音频系统、TV或者打印机等。下面在零知开源平台上进行该功能的测试。 2、软件和硬件 硬件我们本次使用零知-ESP8266; 软件使用零知开发工具(持续更新中),自带示例: 3、方法步骤 (1)先在零知开发工具中打开SSDP示例,或者复制下面的代码到零知开发工具中: /********************************************************** * 文件: x.ino by 零知实验室([url=http://www.lingzhilab.com]www.lingzhilab.com[/url]) * -^^- 零知开源,让电子制作变得更简单! -^^- * 时间: 2019/05/28 12:22 * 说明: ************************************************************/ # include <ESP8266WiFi.h> # include <ESP8266WebServer.h> # include

Parsing JSON code with ESP8266

*爱你&永不变心* 提交于 2019-12-11 17:08:37
问题 I'm testing a piece of code to see if I can parse the JSON code I'm receiving. I basically copied the code from: ArduinoJson/assistant So I've placed the received JSON string in a const char* to see if it works, but I get a weird response instead of a normal integer result. Does somebody know what is going on here? PS I know it's a huge response from the server, while I only need like 2 data's from. Here's my code: #include <ArduinoJson.h> void setup() { Serial.begin(115200); Serial.println(

MicroPython urequests.post failures

荒凉一梦 提交于 2019-12-11 16:57:59
问题 I'm trying to receive notifications on my (Android) mobile device from an ESP8266 MCU running MicroPython. For this reason I subscribed to a couple of online services exposing some APIs for this task, Pushbullet, and Pushed, and I installed the matching apps on my device. This is what I'm trying: Pushbullet: import json import urequests body = "Test Notification" title = "Pushbullet" data_sent = {"type": "note", "title": title, "body": body} API_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx' pb_headers

ESP8266 No response in serial monitor from official AT firmware

倖福魔咒の 提交于 2019-12-11 15:39:11
问题 I've been trying to get the AT commands to run on my ESP8266. I failed on my first attempt using the approach described in this question I posted: ESP8266 AT+CWLAP gives generic ERROR message with no details So I decided to use a second approach which uses these official SDKs and Firmware: ESP8266 NONOS SDK V2.0.0 20160810 ESP8266 Flash Tools I connected my Arduino Uno as a bridge to my ESP8266 based on these pin connections: ESP8266 | Arduino ----------------------- TX | TX RX | RX CH_PD | 3

UART data error when using uart.alt(1)

痞子三分冷 提交于 2019-12-11 13:48:10
问题 I am trying to acquire rs232 data from a device connected to the ESP8266 (data will then be sent our via http/wifi). I am using max3232 IC to provide the necessary 3.3v TTL to the ESP8266. I have have connected the max3232 (pin 12) to GPIO pin 13 (rx) on the ESP8266 (I am only receiving data not sending data, so only the rx pin is connected). The code i am using: -- --file: test2.lua -- tst2 = require "tst2" tst2.start() --tst2.lua (testing script) local module = {} function module.start()

NodeMCU and ESP8266: slow mqtt publish

▼魔方 西西 提交于 2019-12-11 13:15:17
问题 I'm using esp8266 with the firmware produced with Marcel's NodeMCU custom builds http://frightanic.com/nodemcu-custom-build/ I tested the "dev" branch and the "master". I changed a little bit the " Connect to MQTT Broker " code found here https://github.com/nodemcu/nodemcu-firmware -- init mqtt client with keepalive timer 120sec m = mqtt.Client("clientid", 120, "user", "password") m:on("connect", function(con) print ("connected") end) m:on("offline", function(con) print ("offline") end) -- m

How to print response to AT commands in Arduino serial port?

心已入冬 提交于 2019-12-11 12:38:29
问题 I want to print the response to AT command. I'm sending AT command but I'm not getting any response in the Arduino serial port. It's giving -1 instead of OK. #include "SoftwareSerial.h" String ssid = "connectify-krish"; String password = "12345678"; String myword= ""; SoftwareSerial esp(10, 11); void setup() { Serial.begin(9600); esp.begin(9600); esp.write("AT"); Serial.println(esp.read()); } void loop() {} 回答1: As already pointed out in the comments you are not terminating the AT command