03-26-2020 02:33 PM
Data transfer sketch:
#include <Wire.h>
#include "I2Cdev.h"
#include "MPU6050.h"
#define T_OUT 20
MPU6050 accel;
unsigned long int t_next;
void setup() {
Serial.begin(9600);
accel.initialize();
Serial.println(accel.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");
}
void loop() {
long int t = millis();
if( t_next < t ){
int16_t ax_raw, ay_raw, az_raw, gx_raw, gy_raw, gz_raw;
t_next = t + T_OUT;
accel.getMotion6(&ax_raw, &ay_raw, &az_raw, &gx_raw, &gy_raw, &gz_raw);
Serial.print(ax_raw);
Serial.print(ay_raw);
Serial.print(az_raw);
Serial.println();
}
}
I do not understand how to read data from the accelerometer in order to display x, y, z on the screen
I more or less understood how to output only x
I don`t want to use Makehub and Arduino libraries
Please help me
03-26-2020 03:01 PM