I am trying to connect my photon to the particle.io cloud with the following code. However, when I monitor the variables on the particle cli, they return a really large negative integer like -1231412412412412412421 for all three ax, ay, and az.
Can someone please help me. Thank you in advance.
Also, note that I am using the MPU6050 library.
I have wired my photon to MPU6050 properly:
D0 -> SDA
D1 -> SCL
VCC
GND
#include "application.h"
#include "MPU6050/MPU6050.h"
MPU6050 accelgyro;
int16_t ax, ay, az;
int16_t gx, gy, gz;
// setup() runs once, when the device is first turned on.
void setup() {
// Put initialization like pinMode and begin functions here.
Wire.begin();
accelgyro.initialize();
Particle.variable("ax", ax);
Particle.variable("ay", ay);
Particle.variable("az", az);
}
// loop() runs over and over again, as quickly as it can execute.
void loop() {
// The core of your code will likely live here.
accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
}