有關ESP32的部分問題

2021-08-09 22:00:36 字數 1801 閱讀 2536

*在該項目的第乙個demo中,我是使用esp8266來實現wifi傳輸功能,esp8266內建了乙個lua指令碼翻譯器

,可以通過串列埠傳輸lua指令碼程式對其進行二次開發控制,當時使用的lua指令碼如下:*

wifi.setmode(wifi.softap)

cfg={}

cfg.ssid="my_wifi"

cfg.pwd="12345678"

cfg.ip="192.168.0.2"

cfg.netmask="255.255.255.0"

cfg.gateway="192.168.0.1"

udp_port = 9878

wifi.ap.setip(cfg)

wifi.ap.config(cfg)

print("esp8266 udp to serial bridge v1.0 by roboremo")

print("ssid: " .. cfg.ssid .. " pass: " .. cfg.pwd)

print("baudrate will change now to 921600")

tmr.alarm(0,200,0,function

() -- run after a delay

uart.setup(0, 921600, 8, 0, 1, 1)

udpsocket = net.createserver(net.udp,28800)

udpsocket:listen(udp_port)

udpsocket:on("receive", function

(conn)

uart.on("data", 0, function

(data)

conn:send(data)

end, 0)

conn:on("receive",function

(conn,payload)

uart.write(0, payload)

end)

end)

end)

以上指令碼實現乙個udp server 接受回傳功能,即通過udp接收資料,串列埠傳送。

在esp32的sdk中udp的api如下

/* udp_perf example

this example code is in the public domain (or cc0 licensed, at your option.)

software is distributed on an "as is" basis, without warranties or

conditions of any kind, either express or implied.

*/#ifndef __udp_perf_h__

#define __udp_perf_h__

#include "driver/uart.h"

#include "freertos/queue.h"

#define ex_uart_num uart_num_0

#define buf_size (1024)

static queuehandle_t uart0_queue;

#ifdef __cplusplus

extern

"c"

#endif

#endif /*#ifndef __udp_perf_h__*/

同時,在此api基礎上,樂鑫實現了乙個udp通訊的example,其功能是簡單的udp接收幀計數和每秒接收的位元數顯示。

ESP32模組比較

esp32系列無線ic是樂鑫espressif出品的價效比高的藍芽wifi雙模ic。官網 最詳細的手冊文件為 esp32 technical reference manual cn.pdf 將官方和一些其他方的模組列表比較,包括資源,也把晶元放進去。esp32單核晶元用的少沒有列出。可以看出,安信可...

ESP32 學習記錄

首次接觸freertos和espressif的產品,例如我,那還是要先來個整體印象,然後再逐個深化。做專案的都知道,老闆們是不允許我們四平八穩的研究完然後再開始專案。那也不妨礙咱們要有自己的節奏,既要平衡專案的進度,也要按照事情的規律來做事情 這就需要快速的準備一些預備知識,磨刀不誤砍柴功,倉促上陣...

esp32啟動流程

步驟 1 固化在esp32 rom 中的 boot1 從 flash 0x1000位址處 載入boot2 至ram iram dram 中。2 boot2從 flash 中載入partitions.csv 和 image.bin 至記憶體中,image.bin 中包含了 ram 段和通過 flash...