Python MicroxisI86运动跟踪驱动程序

micropython-mpu6886的Python项目详细描述


[WIP]MicroPython MPU-6886 I2C驱动程序

MPU-6886是一种6轴运动跟踪装置,它结合了3轴陀螺仪和3轴加速度计。在

使用

简单测试永不结束。在

importutimefrommachineimportI2C,Pinfrommpu6886importMPU6886i2c=I2C(scl=Pin(22),sda=Pin(21))sensor=MPU6886(i2c)print("MPU6886 id: "+hex(sensor.whoami))whileTrue:print(sensor.acceleration)print(sensor.gyro)print(sensor.temperature)utime.sleep_ms(1000)

默认情况下,库返回加速度和陀螺仪的X、Y、Z轴值的3元组。默认单位是m/s^2rad/s°C。也可以得到g中的加速度值和deg/s的陀螺值。请参阅下面的示例。在

^{pr2}$

更现实的例子使用计时器。如果在软重新引导后得到OSError: 26i2c driver install error,请执行硬重新引导。在

importmicropythonfrommachineimportI2C,Pin,Timerfrommpu6886importMPU6886micropython.alloc_emergency_exception_buf(100)i2c=I2C(scl=Pin(22),sda=Pin(21))sensor=MPU6886(i2c)defread_sensor(timer):print(sensor.acceleration)print(sensor.gyro)print(sensor.temperature)print("MPU6886 id: "+hex(sensor.whoami))timer_0=Timer(0)timer_0.init(period=1000,mode=Timer.PERIODIC,callback=read_sensor)

陀螺校准

托多

许可证

麻省理工学院执照。有关详细信息,请参见License File。在

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
添加组件后,java JTable为空   java将json发送到php并插入mysql,但返回null   java Spring引导JNDI CommonJ资源   从不同PC创建和合并后的Java servlet问题   java如何在使用findelements时从xpath获取文本   java使用spring boot使用gmail smtp发送电子邮件   java在不使用pojo、bean或getter和setter的情况下获取Json标题的Json数组   Java中的OpenFile对话框将null作为响应   JavaBuilder模式。扩展接口   java中无需替换的数据结构选取   java如何评价Encog中的预测神经网络   java如何在安卓中使用实际的HttpURLConnection进行单元测试?   java使用XML配置禁用WebSocket中的CSRF保护   java如何通过hibernate从多表查询中获取数据?   mysql如何在java中获取更新的行Id   java AEM/CQ组件单一组件/有限组件   java FFmpeg Javacv延迟问题   显示整数数组的java不起作用