Posts: 1
Joined: Tue Jan 31, 2017 2:56 pm

Microstack Accelerometer problem with usage

Tue Jan 31, 2017 3:13 pm

Hey guys,
i'm working on a project and at this point i tried to install and use the Microstack Accelerometer AAM8452Q. I had a few problems with it (i have one of the boards, where the pins were not connected, but i soldered it and now it works), but i can execute the example and it works fine.

My problem now is, that i wanted to write my own python program basing on the used functions in the example. So i created a file in my projet folder (/home/...) and wrote the following code:

Code: Select all

import microstacknode.hardware.accelerometer.mma8452q
with MMA8452Q() as accelerometer:
 while True:
I got the following Error: NameError: name 'MMA8452Q' is not defined.
So i tried another possibility described from Microstack:

Code: Select all

import microstacknode.hardware.accelerometer.mma8452q
accelerometer = microstacknode.hardware.accelerometer.mma8452q.MMA8452Q()
while True:
That delivers another error:
File "/usr/lib/python3/dist-packages/microstacknode/hardware/accelerometer/", line 194, in get_xyz
buf = self.transaction(reading(self.i2c.address, 7)) [0]
File "/usr/lib/python3/dist-packages/microstackcommon/", line 85, in transaction
ioctl(self.fd, I2C_RDWR, ioctl_arg)
AttributeError: 'MMA8452Q' object has no attribute 'fd'

I looked up the and it needs that attribute, i have no idea, why this error occurs.

I hope someone can help me, i really fall into despair :(

Return to “Add-ons”

Who is online

Users browsing this forum: No registered users and 4 guests