当我第一次连接罗盘传感器时,我意外地将5v连接到地,接地到SCL,SCL到SDA和SDA到DRDY。但是当我纠正这个并运行python程序时,它输出了一个数字。但是这个数字并没有改变。我有可能把烧焦了吗?我的代码是: 进口smbus 进口时间 bus = smbus.SMBus(1) 地址= 0x1e
def bearing255():
bear = bus.read_byte_data(address, 1)
return bear
def bearing3599():
bear1 = bus.read_byte_data(address, 2)
bear2 = bus.read_byte_data(address, 3)
bear = (bear1 << 8) + bear2
bear = bear/10.0
return bear
while True:
bearing = bearing3599()
bear255 = bearing255()
print bearing
print bear255
time.sleep(1)