Den 2017-11-06 kl. 12:14, skrev Tony van der Hoff:
>>
>> I've not used this device, but in emails with others what I gather is that
>> you need to make sure it's not in self-test mode and that the registers
>> (scaling, etc.) are set correcty, and that it's not in sleep mode, then
>> trigger it to take a sample. Until then, the default values are all zeros.
>>
>> Or put it into continuous sample mode.
>>
>> So go and read the fine manual before writing it off!
>>
>> -Gordon
>>
>
> You have to send it a wake-up signal. Write a 0 to register 0x6b.
>
> See
> http://blog.bitify.co.uk/2013/11/reading-data-from-mpu-6050-on-raspberry.html
> for a python program
>
Thanks for the hints.
I downloaded the code and adjusted for bus 1
pi@raspberrypi:~ $ sudo python gt.py
gyro data
---------
Traceback (most recent call last):
File "gt.py", line 46, in
gyro_xout = read_word_2c(0x43)
File "gt.py", line 20, in read_word_2c
val = read_word(adr)
File "gt.py", line 15, in read_word
low = bus.read_byte_data(address, adr+1)
IOError: [Errno 121] Remote I/O error
this is using 0x6 as the data sheet and other web-pages suggests.
Changing to use 0x6c as wake-up (as the code suggests)
I get no crash but just zeros
pi@raspberrypi:~ $ sudo python gt.py
gyro data
---------
gyro_xout: 0 scaled: 0
gyro_yout: 0 scaled: 0
gyro_zout: 0 scaled: 0
accelerometer data
------------------
accel_xout: 0 scaled: 0.0
accel_yout: 0 scaled: 0.0
accel_zout: 0 scaled: 0.0
x rotation: 0.0
y rotation: -0.0
I think I'll try it in an arduino uno before I return it.
--
--
Björn
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|