chirimen-oh / chirimen.org

Tutorials for CHIRIMEN
https://tutorial.chirimen.org/
Mozilla Public License 2.0
3 stars 7 forks source link

icm20948 not working correctly on raspberry pi 4 #134

Open benjamin0789 opened 7 months ago

benjamin0789 commented 7 months ago

Accelerometer and gyro-values are always 0. I´m using the waveshare environment hat.

`async init() {

    const i2cAccess = await requestI2CAccess();
    const port = i2cAccess.ports.get(1);

    this.mod = new ICM20948(port, 0x68)

    await this.mod.init();
  }

  async read() {

    console.log('update');
    await this.mod.getdata();

    await firstValueFrom(timer(1000).pipe(first()))

    console.log("ACCEL: ", this.mod.Accel);
    console.log("GYRO: ", this.mod.Gyro);
    console.log("MAG:", this.mod.Mag);
  }`

log:

ACCEL: [ 0, 0, 0 ] GYRO: [ 0, 0, 0 ] MAG: [ 24832.5, -19693, 30011.125 ]