首页 > 解决方案 > 制作软接入点ESP8266并通过labview读取数据

问题描述

我使用 AT 命令并使用 ESP8266 (ESP - 12 - F)、Atmega32a 和 Codvision AVR 编程创建了一个软访问点。然后我用笔记本电脑连接到这个wifi热点,并在labview和ESP8266(ESP-12-F)之间正确连接。ESP 设备读取传感器的模拟量,Labview 接收数据并绘制直方图...... 这太棒了,但是采样率太低了,我每秒可以采样 100 个。增加 AVR 和 ESP 模块之间的波特率不会显着改变采样率。所以我想用 Arduino 做这个项目。我在软接入点中设置了 ESP,我用 Labview 连接到模块,但我无法在它们之间读/写数据。我的代码在这里,我的问题是什么命令可以从 ESP 向 Labview 发送/接收数据。data 是一个 4 位数字(ADC 数量)。我从Arduino网站上阅读了Soft AP中WiFi库的官方文档,但是没有明确的命令在这种模式下发送和接收数据。谁能帮助完成这个项目?我尝试在它们之间达到 2 Mb 的速度。

#include<ESP8266WiFi.h>
#include<WiFiClient.h>
#include<ESP8266WebServer.h>
/* Set these to your desired credentials. */
const char *ssid = "ESPap";
const char *password = "thereisnospoon";
ESP8266WebServer server(8080); // PORT DETERMINE

/* Just a little test message.  Go to http://192.168.4.1 in a web browser
connected to this access point to see it.
*/
void handleRoot() {
server.send(200, "text/html", "<h1>You are connected</h1>");
}
void setup() {
delay(1000);
Serial.begin(115200);
Serial.println();
Serial.print("Configuring access point...");
/* You can remove the password parameter if you want the AP to be open. */
WiFi.softAP(ssid, password);

IPAddress myIP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(myIP);
//server.on("/", handleRoot);
server.on("/other", [](){
server.send(200, "text/plain", "Other URL");

});
server.begin();
Serial.println("HTTP server started");
}

void loop() {
server.handleClient();
}

标签: arduinoesp8266

解决方案


推荐阅读