我使用Arduino
uno 将草图上传到 esp 01 模块。我附上了我如何连接esp-01
和的图像mpu6050
,浏览器连续打印陀螺仪值,但增加 0.01 我需要实际的陀螺仪值
[1]
#include <ESP8266WiFi.h>
#include <MPU6050_tockn.h>
#include <Wire.h>
MPU6050 mpu6050(Wire);
const char* ssid = "TP-LINK";
const char* password = "1913131";
// Create an instance of the server
// specify the port to listen on as an argument
WiFiServer server(80);
void setup() {
Serial.begin(115200);
delay(1000);
// Connect to WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
// Start the server
server.begin();
Serial.println("Server started");
// Print the IP address
Serial.println(WiFi.localIP());
delay(5000);
//Serial.begin(9600);
Wire.begin(0,2);
delay(1000);
mpu6050.begin();
delay(1000);
mpu6050.calcGyroOffsets(true);
delay(1000);
}
void loop() {
// Check if a client has connected
WiFiClient client = server.available();
if (!client) {
Serial.print("Client did not connect");
delay(1000);
return;
}
// Wait until the client sends some data
Serial.println("new client");
while (!client.available()) {
delay(1);
}
while(client.available()){
mpu6050.update();
client.print(mpu6050.getGyroAngleX());
client.print(",");
client.print(mpu6050.getGyroAngleY());
client.print(",");
client.println(mpu6050.getGyroAngleZ());
delay(10);
}
delay(1);
Serial.println("Client disonnected");
// The client will actually be disconnected
// when the function returns and 'client' object is detroyed
}
> Blockquote
当客户端实际连接时,当我在浏览器中输入 IP 地址时,浏览器中打印的值为 0.69,0.69,0.60 0.70,0.70,0.60 0.70 并继续将值增加 0.01,但我需要实际的陀螺仪读数。请帮帮我
我连接了 esp 01 和 mpu6050 就像这张图片列表项