Hi,
I have problems to read the Minimu 9 v5 sensor data with python.
The result is:(-3980, 1206, 4994, 3, 100, 0)
But the values do not change. The results is every time the same.
If I reboot the operating system the values are differently.
I have found the new pololu/minimu-9-ahrs-arduino example.
I think I can not found the right write_byte_data values.
I try to read the sensor data with the follow code.
Thank you for reading.
import smbus
import time
bus = smbus.SMBus(1)
address = 0x1e
#address2 = 0x6b
print bus.read_byte_data(address, 0x0f) # Output 61
#CTRL1_XL
bus.write_byte_data(address,0x10,0b10100111)
#CTRL2_G
bus.write_byte_data(address,0x11,0x00)
#CTRL5_C
bus.write_byte_data(address,0x14,0b01100100)
#CTRL6_C
bus.write_byte_data(address,0x15,0b00100000)
#CTRL7_G
bus.write_byte_data(address,0x16,0x44)
#Convert Bytes to Number
def byteToNumber(val_1,val_2):
number = 256 * val_2 + val_1
if number >= 32768:
number= number - 65536
return number
def readSensorData():
#Read acc x 0x28 & 0x29
AX = byteToNumber(bus.read_byte_data(address, 0x28),bus.read_byte_data(address, 0x29))
#Read acc y 0x2a & 0x2b
AY = byteToNumber(bus.read_byte_data(address, 0x2A),bus.read_byte_data(address, 0x2B))
#Read acc z 0x2c & 0x2d
AZ = byteToNumber(bus.read_byte_data(address, 0x2C),bus.read_byte_data(address, 0x2D))
#Read gyro x 0x22 & 0x23
GX = byteToNumber(bus.read_byte_data(address, 0x22),bus.read_byte_data(address, 0x23))
#Read gyro y 0x24 & 0x25
GY = byteToNumber(bus.read_byte_data(address, 0x24),bus.read_byte_data(address, 0x25))
#Read gyro z 0x26 & 0x27
GZ = byteToNumber(bus.read_byte_data(address, 0x26),bus.read_byte_data(address, 0x27))
return AX, AY, AZ, GX, GY, GZ
while True:
SensorData = readSensorData()
print SensorData
#Output (-3980, 1206, 4994, 3, 100, 0)
time.sleep(0)