简体   繁体   English

我在Raspberry Pi 2B中使用L3GD20进行错误检测

[英]I got a error sensoring with L3GD20 in Raspberry pi 2B

I am creating a mobile robot, so I am using Raspberry Pi with Adafruit_I2C library, so I need to get Axis Z degree, the idea is to determine the angle when turning in a curve. 我正在创建一个移动机器人,因此我将Raspberry Pi与Adafruit_I2C库一起使用,因此我需要获取Axis Z轴度,其想法是确定弯道时的角度。 Code: def read(self): 代码:def读取(自己):

    # Read gyro values
    list = self.gyro.readList(self.L3GD20_REGISTER_OUT_X_L | 0x80, 6)
    res = [(self.gyro16(list, 0)*self.sensitivity,
            self.gyro16(list, 2)*self.sensitivity,
            self.gyro16(list, 4)*self.sensitivity )]

    return res

The error is this: 错误是这样的:

Traceback (most recent call last):
 File "L3GD20.py", line 119, in <module>
   print l3.read()
 File "L3GD20.py", line 104, in read
  res = [(self.gyro16(list, 0)*self.sensitivity, 
 AttributeError: 'L3GD20' object has no attribute 'sensitivity'

Someone knows how to fix this problem?? 有人知道如何解决这个问题吗? Thanks!! 谢谢!!

我认为您必须更改整个代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Raspberry Pi 2B (armv7h Arch Linux ARM) (python 3.9.8) 上安装加密问题 - Issue installing cryptography on Raspberry Pi 2B (armv7h Arch Linux ARM) (python 3.9.8) 树莓派与ds18b20接口 - raspberry pi interfacing with ds18b20 更新错误 (Stretch) - Raspberry Pi 3 b+ - Update error (Stretch) - Raspberry Pi 3 b+ 在使用 NRF24L01+ 从 Arduino 发送的 Raspberry pi 3b+ 上读取 Python 中的结构时出错 - Error reading Struct in python on Raspberry pi 3b+ sent from Arduino using NRF24L01+ 脚本在启动时运行,带有DS18B20的Raspberry Pi A +蓝牙不起作用 - Raspberry Pi A+ Bluetooth with DS18B20 not working when script runs on boot Raspberry Pi 3B上的pymodbus和电表连接错误 - pymodbus on Raspberry Pi 3B and Energy Meter Connection Error 我可以在Raspberry Pi 2 Model B上将此版本的Ubuntu使用picamera吗? - Can I use picamera with this version of Ubuntu on a Raspberry Pi 2 Model B? 如何在树莓派中直接从DS18B20传感器创建XML文件? - How to Create an XML file directly from DS18B20 sensor in raspberry Pi? 使用 Raspberry Pi 更快地读取多个 DS18B20 温度传感器 - Read multiple DS18B20 temperature sensors faster using Raspberry Pi 覆盆子PI B +上的python 2.7 cvtColor错误215 - python 2.7 cvtColor error 215 on raspberry PI B+
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM