Skip to content

MPU6050 ReadRotation not working #544

@DiscreteTom

Description

@DiscreteTom

When I call ReadRotation, MPU6050 will stuck.

Code:

package main

import (
	"machine"
	"time"

	"tinygo.org/x/drivers/mpu6050"
)

func main() {
	// Initialize the I2C bus & mpu6050 sensor
	machine.I2C0.Configure(machine.I2CConfig{})
	sensor := mpu6050.New(machine.I2C0)
	sensor.Configure()
	sensor.SetFullScaleAccelRange(mpu6050.AFS_RANGE_2G)
	sensor.SetFullScaleGyroRange(mpu6050.FS_RANGE_250)

	for {
		ax, ay, az := sensor.ReadAcceleration()
		// rx, ry, rz := sensor.ReadRotation() // this is not working yet, mpu6050 will stuck

		println(ax, ay, az)

		time.Sleep(10 * time.Millisecond)
	}
}

But if I use Arduino, with lib in https://github.com/adafruit/Adafruit_MPU6050 , run the https://github.com/adafruit/Adafruit_MPU6050/blob/master/examples/basic_readings/basic_readings.ino example, it works fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions