shredability
Member
I'm having troubles interfacing my Teensy 3.0 w/ a MPU 6050. From my research, it seemed like a pretty simple task but I'm having troubles getting the devices to even communicate properly. This is the breakout board I'm using:
https://www.sparkfun.com/products/11028
I'm using pins 18,19 on the teensy 3.0. I have tried the I2C scanner, is that even compatible with the Teensy? its not returning anything. I'm using 1.6k pullups and just 4 pins on the breakout - GND, VDD, SDA and SCL.
When I open the serial terminal, its not printing "GoTdAtA" indicating I'm not even reading the device properly. Thanks in advance for any guidance.
https://www.sparkfun.com/products/11028
I'm using pins 18,19 on the teensy 3.0. I have tried the I2C scanner, is that even compatible with the Teensy? its not returning anything. I'm using 1.6k pullups and just 4 pins on the breakout - GND, VDD, SDA and SCL.
Code:
#include <i2c_t3.h>
void setup()
{
int error;
Serial.begin(9600);
Wire.begin(I2C_MASTER, 0x00, I2C_PINS_18_19, I2C_PULLUP_EXT, I2C_RATE_400);
Wire.beginTransmission(0x68); //0x68 is the I2C DEVICE ADDRESS
Wire.write(0x1B); //SEND GYRO CONFIG REGISTER!!!!
Wire.write(B00011000); //2000degrees per minuite
Wire.write(0x1C); //Accel. config register
Wire.write(B00000000); //+-2gs
Wire.write(0x6B); //disable sleep and whatnot
Wire.write(0);
Wire.endTransmission();
}
void loop()
{
byte AxL, AxH, AyL, AyH, AzL, AzH;
byte GxL, GxH, GyL, GyH, GzL, GzH;
while(1)
{
Wire.beginTransmission(0x68); //I2C Adress
Wire.write(0x43); //gyro data register
Wire.endTransmission();
//Begin data transfer from acce
Wire.requestFrom(0x68,1); //I2C Adress
while(Wire.available())
{
AxH = Wire.receive();
Serial.print("GoTdAtA");
}
Wire.requestFrom(0x68,1);
while(Wire.available())
{
AxL = Wire.receive();
Serial.print("GoTdAtA");
}
Wire.endTransmission();
Serial.print(AxH,HEX);
Serial.println(AxL,HEX);
delay(1000);
}
}
When I open the serial terminal, its not printing "GoTdAtA" indicating I'm not even reading the device properly. Thanks in advance for any guidance.