esp8266

esp8266 SDK开发之编译流程

丶灬走出姿态 提交于 2020-01-13 21:06:21
最近刚完成自己8266的小项目,已经发布在github上,有兴趣的朋友可以看一下 github地址: esp-ujn 1. 通过MQTT协议与服务器交互 2. 内置HTTP服务器,支持通过浏览器进行参数配置 编译流程分析 我们在编译8266代码时可以使用项目中的 gen_misc.sh (Windows下为 gen_misc.bat )脚本,选择合适的参数后就会在 sdk/bin/ 文件夹中生成可烧录的文件,如 eagle.flash.bin , eagle.irom0text.bin 。 但这样存在的问题是每次编译时都需要选择一遍编译参数,所以一般会使用 make 命令进行编译,如: make COMPILE=gcc BOOT=none APP=0 SPI_SPEED=40 SPI_MODE=QIO SPI_SIZE_MAP=4 这是因为 gen_misc.sh 的作用仅仅是供用户选择编译参数,最终的编译过程是通过 make 命令依据Makefile文件中定义的若干规则来进行的。接下来通过如下几个方面来探讨整个编译流程 Makefile的组织形式 烧录文件的生成过程 Makefile的执行过程 一、Makefile的组织形式 SDK中Makefile文件以树形结构组织。总体上分为3类:主文件,项目配置文件,库配置文件。 |--sdk/ |----Makefile |---

ESP8266 01S 外部Flash

瘦欲@ 提交于 2020-01-13 03:57:13
文章目录 学习记录 外部Flash 特点 头文件 API 定义 user_init() 注意事项 其它API 学习记录 ESP8266 01S 外部Flash 外部Flash ESP 01S 外部Flash=1MB=1024KB=8Mbit 1MB Flash = 0x000 000 ~ 0x0FF FFF 扇区编号:0x000 ~ 0x0FF [Flash扇区=4KB] 特点 外部Flash,除了存储系统程序、系统参数外,还可以用来存储用户数据,复位后也不会丢失用户数据。 头文件 API 定义 # define SPI_FLASH_SEC_SIZE 4096 // Flash扇区大小 //4KB //================================================================================== // 全局变量 //================================================================================== u16 N_Data_FLASH_SEC = 0x77 ; // 存储数据的扇区编号 u32 A_W_Data [ 16 ] = { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 , 12 ,

How to prevent WiFi Password from being leaked from Lua code?

梦想的初衷 提交于 2020-01-06 20:22:45
问题 I have a Lua program which connects to a wifi network. The wifi password is hardcoded in the Lua code. I put the Lua code on an ESP8266 which runs on the NodeMCU firmware. Here is the code I use: wifi.setmode(wifi.STATION) wifi.sta.config("SSID", "password") wifi.sta.connect() srv = net.createServer(net.TCP) srv:listen(80,function(conn) conn:on("receive", function(conn, payload) print(payload) local response = "HTTP/1.1 200 OK\r\n\r\n<h1> Hello, NodeMcu.</h1>" conn:send(response, function()

NodeMCU timeout when using while loop

前提是你 提交于 2020-01-06 20:02:56
问题 I have a Lua script that sends an email to myself via SMTP. Everything works fine when uploading to the NodeMCU and saying dofile("sendemail.lua") . -- sendmail.lua -- The email and password from the account you want to send emails from MY_EMAIL = "REDACTED" EMAIL_PASSWORD = "REDACTED" -- The SMTP server and port of your email provider. -- If you don't know it google [my email provider] SMTP settings SMTP_SERVER = "isp.smtp.server" SMTP_PORT = 25 -- The account you want to send email to mail

Trouble connecting NodeMCU to Microsoft Azure IoT Hub

让人想犯罪 __ 提交于 2020-01-06 19:53:14
问题 I am trying to connect my ESP8266, running the latest NodeMCU build, to a Microsoft Azure IoT Hub via MQTT Protocol. It appears that this is possible, as it is shown here... http://thinglabs.io/workshop/esp8266/sending-d2c-messages/ I am using the correct syntax as far as I can see from the MS Azure help... https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-mqtt-support Unlike the example in ThingLabs, which creates a SAS token using NodeMCU, I have followed the MS document and generated

Attempting MQTT connection…failed, rc=-2 try again in 5 seconds

自古美人都是妖i 提交于 2020-01-06 14:31:56
问题 I am trying to establish MQTT communication with my local MQTT server on my pc (node.js, express, Mosca) and Esp8266. esp8286 is not connecting with my server, the error is Attempting MQTT connection...failed, rc=-2 try again in 5 seconds Can't connect to Broker. Here is Node js code: var moscaSettings = { host: '0.0.0.0', port: 1883, http: { port: 8002, host: '0.0.0.0', static: './mqtt/', bundle: true, }, }; var server = new mosca.Server(moscaSettings); // var server = new mosca.Server({ //

Attempting MQTT connection…failed, rc=-2 try again in 5 seconds

核能气质少年 提交于 2020-01-06 14:29:08
问题 I am trying to establish MQTT communication with my local MQTT server on my pc (node.js, express, Mosca) and Esp8266. esp8286 is not connecting with my server, the error is Attempting MQTT connection...failed, rc=-2 try again in 5 seconds Can't connect to Broker. Here is Node js code: var moscaSettings = { host: '0.0.0.0', port: 1883, http: { port: 8002, host: '0.0.0.0', static: './mqtt/', bundle: true, }, }; var server = new mosca.Server(moscaSettings); // var server = new mosca.Server({ //

Connecting NodeMCU Lua socket client with node.js socket.io server

。_饼干妹妹 提交于 2020-01-05 04:24:11
问题 I want to connect a NodeMCU Lua socket client to node.js socket.io server. NodeMCU Lua code: sk = net.createConnection(net.TCP, 0) sk:on("receive", function ( sck,c ) print (c) end) sk:on("connection", function ( sck,c ) print("Connected") sk:send("Helloooo...") end) sk:connect(12346,"192.168.1.100") Node.js server code: var express = require('express'); var app = express(); var server = require('http').Server(app); var io = require('socket.io')(server); io.on('connection', function(socket){

Android connection with ESP8266 on One Plus ( Android 6.0.1)

≯℡__Kan透↙ 提交于 2020-01-04 09:36:35
问题 Retrofit on Android 6.0 has a problem making Http calls after connecting to Access Point Steps to reproduce: Connect to Esp8266 Access Point Make an http call to http://192.168.4.1 (Default gateway of esp8266 accesspoint) The IP address of WIFI is 192.168.4.2 It throws the below exception I have tried the same on Android 5.1 and the same code works flawlessly java.net.SocketException: socket failed: ENONET (Machine is not on the network) at libcore.io.IoBridge.socket(IoBridge.java:619) at

ESP266 Timed out waiting for packet header

帅比萌擦擦* 提交于 2020-01-04 02:57:08
问题 I am trying to flash the AT firmware in esp8266 but I am always getting the error of timed out waiting for packet header. Note : I am using esptool.py to flash the the chip and I already have some code uploaded to it, which I uploaded using Arduino IDE Here is the error which i am getting while writing flash: root@mayank-HP-Notebook:/home/mayank/Desktop# esptool.py -b 115200 -p /dev/ttyACM0 write_flash 0x000000 "ESP_8266_BIN0.92.bin" esptool.py v1.2-dev Connecting... Running Cesanta flasher