However, when running the example sketch and turn off the sensor, I cannot get the sensor working again. This is the reduced sketch I used:
Code: Select all
// Basic demo for accelerometer/gyro readings from Adafruit LSM6DS33
#include <Adafruit_LSM6DS33.h>
#include <Wire.h>
Adafruit_LSM6DS33 lsm6ds33;
#include <SparkFun_Qwiic_Power_Switch_Arduino_Library.h>
QWIIC_POWER mySwitch;
void setup(void) {
Serial.begin(115200);
Wire.begin();
mySwitch.begin();
mySwitch.powerOn();
Serial.println("Adafruit LSM6DS33 test!");
lsm6ds33.begin_I2C();
delay(2000);
}
void loop() {
// /* Get a new normalized sensor event */
sensors_event_t accel;
sensors_event_t gyro;
sensors_event_t temp;
lsm6ds33.getEvent(&accel, &gyro, &temp);
Serial.print(temp.temperature); Serial.print(" ");
/* Display the results (acceleration is measured in m/s^2) */
Serial.print(accel.acceleration.x); Serial.print(" ");
Serial.print(accel.acceleration.y); Serial.print(" ");
Serial.print(accel.acceleration.z); Serial.println(" ");
delay(1000);
mySwitch.powerOff();
delay(3000);
mySwitch.powerOn();
lsm6ds33.begin_I2C();
}
Anyone any suggestions?