MKR WIFI 1010 using I2C with SparkFunLSM6DSO

I want to use Arduino MKR WIFI 1010 with IMU module SparkFunLSM6DSO.

Here is a example code. This code works perfectly with Arduino UNO and Arduino Nano. But with MKR module I do not get any values. Interesting is that if I load this code on Arduino NANO and initiate data flow then I can simply remove two I2C wires from NANO and connect to the MKR WIFI 1010 (SDA SCL) and the data will be received.But if I reset MKR no data flow available again. Looks like that something is wrong with the wire.begin function for MKR controllers. Does someboday experienced similar problems?

#include "SparkFunLSM6DSO.h"
#include "Wire.h"
//#include "SPI.h"
#define Serial SerialUSB

LSM6DSO myIMU; //Default constructor is I2C, addr 0x6B

void setup() {

Serial.begin(115200);
while (!Serial) { /* spin */ }
Serial.print("Prasideda");
delay(500);

Wire.begin();
delay(5000);
if( myIMU.begin() )
Serial.println("Ready.");
else {
Serial.println("Could not connect to IMU.");
Serial.println("Freezing");
}

if( myIMU.initialize(BASIC_SETTINGS) )
Serial.println("Loaded Settings.");

}

void loop()
{
//Get all parameters
Serial.print("\nAccelerometer:\n");
Serial.print(" X = ");
Serial.println(myIMU.readFloatAccelX(), 3);
Serial.print(" Y = ");
Serial.println(myIMU.readFloatAccelY(), 3);
Serial.print(" Z = ");
Serial.println(myIMU.readFloatAccelZ(), 3);

Serial.print("\nGyroscope:\n");
Serial.print(" X = ");
Serial.println(myIMU.readFloatGyroX(), 3);
Serial.print(" Y = ");
Serial.println(myIMU.readFloatGyroY(), 3);
Serial.print(" Z = ");
Serial.println(myIMU.readFloatGyroZ(), 3);

Serial.print("\nThermometer:\n");
Serial.print(" Degrees F = ");
Serial.println(myIMU.readTempF(), 3);

delay(1000);
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.