You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package main
import (
"machine""time""tinygo.org/x/drivers/mpu6050"
)
funcmain() {
// Initialize the I2C bus & mpu6050 sensormachine.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 stuckprintln(ax, ay, az)
time.Sleep(10*time.Millisecond)
}
}
When I call ReadRotation, MPU6050 will stuck.
Code:
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.
The text was updated successfully, but these errors were encountered: