You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use the following code in Arduino environment, there is no signal at all on either SDA or SCL line. I checked it with an oscilloscope.
From what I have researched, the I2C is not very reliable with BLE Nano 1 or 2. I know that the Nano 1 had a problem with a specific setting in the 'i2c_api.c' file as described by this post. I am wondering if there is a similar fix for the BLE Nano 2, or if someone has had a similar problem?
void setup()
{
Wire.begin(D3, D2, TWI_FREQUENCY_100K);
Wire.beginTransmission(MPU_ADDR);
Wire.write(0x6B); // PWR_MGMT_1 register
Wire.write(0); // set to zero (wakes up the MPU-6050)
Wire.endTransmission(true);
Serial.begin(9600);
}
void loop()
{
Wire.beginTransmission(MPU_ADDR);
Wire.write(0x3B); // starting with register 0x3B (ACCEL_XOUT_H)
Wire.requestFrom(MPU_ADDR,14,true); // request a total of 14 registers
acc[0]= Wire.read()<<8|Wire.read();
acc[1]= Wire.read()<<8|Wire.read();
acc[2]= Wire.read()<<8|Wire.read();
temp = Wire.read()<<8|Wire.read();
gyro[0]= Wire.read()<<8|Wire.read();
gyro[1]= Wire.read()<<8|Wire.read();
gyro[2]= Wire.read()<<8|Wire.read();
Serial.print("AcX = "); Serial.print(acc[0]);
Serial.print(" | AcY = "); Serial.print(acc[1]);
Serial.print(" | AcZ = "); Serial.print(acc[2]);
Serial.print(" | Tmp = "); Serial.print(temp/340.00+36.53); //equation for temperature in degrees C from datasheet
Serial.print(" | GyX = "); Serial.print(gyro[0]);
Serial.print(" | GyY = "); Serial.print(gyro[1]);
Serial.print(" | GyZ = "); Serial.println(gyro[2]);
delay(333);
}`
The text was updated successfully, but these errors were encountered:
Hello,
When I use the following code in Arduino environment, there is no signal at all on either SDA or SCL line. I checked it with an oscilloscope.
From what I have researched, the I2C is not very reliable with BLE Nano 1 or 2. I know that the Nano 1 had a problem with a specific setting in the 'i2c_api.c' file as described by this post. I am wondering if there is a similar fix for the BLE Nano 2, or if someone has had a similar problem?
`#include<Wire.h>
#include<nRF5x_BLE_API.h>
const uint8_t MPU_ADDR = 0x68;
int16_t acc[3], gyro[3], temp;
void setup()
{
Wire.begin(D3, D2, TWI_FREQUENCY_100K);
Wire.beginTransmission(MPU_ADDR);
Wire.write(0x6B); // PWR_MGMT_1 register
Wire.write(0); // set to zero (wakes up the MPU-6050)
Wire.endTransmission(true);
Serial.begin(9600);
}
void loop()
{
Wire.beginTransmission(MPU_ADDR);
Wire.write(0x3B); // starting with register 0x3B (ACCEL_XOUT_H)
Wire.requestFrom(MPU_ADDR,14,true); // request a total of 14 registers
acc[0]= Wire.read()<<8|Wire.read();
acc[1]= Wire.read()<<8|Wire.read();
acc[2]= Wire.read()<<8|Wire.read();
temp = Wire.read()<<8|Wire.read();
gyro[0]= Wire.read()<<8|Wire.read();
gyro[1]= Wire.read()<<8|Wire.read();
gyro[2]= Wire.read()<<8|Wire.read();
Serial.print("AcX = "); Serial.print(acc[0]);
Serial.print(" | AcY = "); Serial.print(acc[1]);
Serial.print(" | AcZ = "); Serial.print(acc[2]);
Serial.print(" | Tmp = "); Serial.print(temp/340.00+36.53); //equation for temperature in degrees C from datasheet
Serial.print(" | GyX = "); Serial.print(gyro[0]);
Serial.print(" | GyY = "); Serial.print(gyro[1]);
Serial.print(" | GyZ = "); Serial.println(gyro[2]);
delay(333);
}`
The text was updated successfully, but these errors were encountered: