LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read MPU6050 data and display

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

image.pngimage.png

I more or less understood how to output only x

I don`t want to use Makehub and Arduino libraries

Please help me

0 Kudos
Message 1 of 2
(1,896 Views)

Hi Toddler,

 

don't use BytesAtPort, just use VISARead and request 99 bytes. The TermChar will handle all the rest…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 2
(1,874 Views)