mpu6886: initial implementation

This commit is contained in:
ivoszz
2023-05-10 16:27:35 +02:00
committed by Ron Evans
parent deca190ba2
commit f3f2d65878
3 changed files with 330 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
// Connects to an MPU6886 I2C accelerometer/gyroscope.
package main
import (
"machine"
"time"
"tinygo.org/x/drivers/mpu6886"
)
func main() {
machine.I2C0.Configure(machine.I2CConfig{})
accel := mpu6886.New(machine.I2C0)
accel.Configure(mpu6886.Config{})
for {
x, y, z, _ := accel.ReadAcceleration()
println(x, y, z)
time.Sleep(time.Millisecond * 100)
}
}