Open
Description
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
Labels
No labels
Activity
soypat commentedon Apr 29, 2023
I ran into a similar bug the other day where ReadRotation would fail to read the gyroscope correctly.
#298 fixes said bug, though I'd like to perform some more changes to it.
Edit: What microcontroller are you using?
DiscreteTom commentedon Apr 30, 2023
Thanks for the response, I'm using Arduino Nano.