I2C programming
I am new about UP square board, so for many of you this post could be not useful. I am trying to use I2C bus for a project that I am going to implement. To make a test a took a gyroscope/accelerometer based on MPU6050 chip (GY-521). I installed the mraa libraries and python libraries suggested in the wiki.
with i2cdetect I find the device recognized in the board (address 0x68) : sudo i2cdetect -r -y 5
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
So I suppose that the bus is number 5 and I wrote this simple code:
import mraa as m
x = m.I2c(0x05) # the bus number
x.address(0x68) # the address of sensor
Running the test I get:
Traceback (most recent call last):
File "test.py", line 3, in
x = m.I2c(0x05)
File "/usr/lib/python3.6/dist-packages/mraa.py", line 507, in init
this = _mraa.new_I2c(bus, raw)
ValueError: Invalid i2c bus
What is wrong ?
Thanks
Massimo
Tagged
Categories
- All Categories
- 63 Announcements & News
- 58 Product News - New Product/Product Change Notice/ End-of-life
- 99 Welcome Developers!
- 46 Unboxing & Project Sharing
- 114 Tech Updates
- 3.4K UP Products
- 14 UP 7000
- 1 UP Squared i12
- 12 UP Xtreme i12
- 13 UP Squared Pro 7000
- 1 UP Element i12 Edge
- 23 UP Squared V2
- 63 UP 4000
- 23 UP Xtreme i11
- 34 UP Squared 6000
- 57 UP Squared Pro
- 135 UP Xtreme
- 820 UP Squared
- 1.4K UP Board
- 74 UP Core Plus
- 217 UP Core
- 3 UP Xtreme Lite
- 40 UP AI Edge
- 265 Starter Kits & Peripheral