tinygo.org/x/drivers@v0.27.1-0.20240509133757-7dbca2a54349/examples/mpu6050/main.go (about) 1 // Connects to an MPU6050 I2C accelerometer/gyroscope. 2 package main 3 4 import ( 5 "machine" 6 "time" 7 8 "tinygo.org/x/drivers/mpu6050" 9 ) 10 11 func main() { 12 machine.I2C0.Configure(machine.I2CConfig{}) 13 14 accel := mpu6050.New(machine.I2C0) 15 accel.Configure() 16 17 for { 18 x, y, z := accel.ReadAcceleration() 19 println(x, y, z) 20 time.Sleep(time.Millisecond * 100) 21 } 22 }