I`ve pruchased to blynk Plus already, however there is no option for me to extract data from my superchat, i can only enlarge the chart.
Hardware : Nodemcu 8266 , Mpu6050 sensor
smartphone : iphone13
code :
#include <Wire.h> // Only needed for Arduino 1.6.5 and earlier
#include "SH1106Wire.h" // legacy: #include "SH1106.h"
#include <Adafruit_Sensor.h>
#define BLYNK_PRINT Serial
#define BLYNK_TEMPLATE_ID "TMPLiNiVSQCx"
#define BLYNK_DEVICE_NAME "Quickstart Template"
#define BLYNK_AUTH_TOKEN "dyyPrXguxjcgsuJixlTNUrcZQaCOfoyS"
#include <Blynk.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
SH1106Wire display(0x3c, SDA, SCL); // ADDRESS, SDA, SCL
//Adafruit_MPU6050 mpu;
const int MPU_addr=0x68;
int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ;
int minVal=265;
int maxVal=402;
double x;
double y;
double z;
char ssid[] = "ESP8266BLYNK"; // Your WiFi credentials.
char pass[] = "MPU6050T";
void setup() {
Wire.begin();
Wire.beginTransmission(MPU_addr);
Wire.write(0x6B);
Wire.write(0);
Wire.endTransmission(true);
Serial.begin(115200);
Serial.println();
Serial.println();
// Initialising the UI will init the display too.
display.init();
display.flipScreenVertically();
display.setFont(ArialMT_Plain_10);
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
}
void loop() {
Blynk.run();
delay(500);
Wire.beginTransmission(MPU_addr);
Wire.write(0x3B);
Wire.endTransmission(false);
Wire.requestFrom(MPU_addr,14,true);
AcX=Wire.read()<<8|Wire.read();
AcY=Wire.read()<<8|Wire.read();
AcZ=Wire.read()<<8|Wire.read();
int xAng = map(AcX,minVal,maxVal,-90,90);
int yAng = map(AcY,minVal,maxVal,-90,90);
int zAng = map(AcZ,minVal,maxVal,-90,90);
x= RAD_TO_DEG * (atan2(-yAng, -zAng)+PI);
y= RAD_TO_DEG * (atan2(-xAng, -zAng)+PI);
z= RAD_TO_DEG * (atan2(-yAng, -xAng)+PI);
Serial.print("AngleX= ");
Serial.println(x);
Serial.print("AngleY= ");
Serial.println(y);
Serial.print("AngleZ= ");
Serial.println(z);
Serial.println("-----------------------------------------");
// put your main code here, to run repeatedly:
// clear the display
display.clear();
display.setTextAlignment(TEXT_ALIGN_LEFT);
String buf;
buf = "X: " + String(x);
display.setFont(ArialMT_Plain_16);
display.drawString(0, 0,buf);
buf = "Y: " + String(y);
display.setFont(ArialMT_Plain_16);
display.drawString(0, 16,buf);
buf = "Z: " + String(z);
display.setFont(ArialMT_Plain_16);
display.drawString(0, 32,buf);
delay(1000);
display.display();
Blynk.virtualWrite(V0, x);
Blynk.virtualWrite(V1, y);
Blynk.virtualWrite(V2, z);
}