MMA88451 doesn’t work with raspbterry pi out of the box. It needs I2C with repeated start. Test program in python:
import smbus
DEVICE_ADDRESS = 0x1d
MMA8451_REG_WHOAMI = 0x0D
bus = smbus.SMBus(1)
ret = bus.read_byte_data(DEVICE_ADDRESS, MMA8451_REG_WHOAMI)
print ret
Shows zero instead of expected 26 (0x1A in hex)
pi@occberry ~/OpenCyclingComputer $ sudo python src/mma8451.py
0
Solution that I found here solves the problem:
sudo chmod 666 /sys/module/i2c_bcm2708/parameters/combined
sudo echo -n 1 > /sys/module/i2c_bcm2708/parameters/combined
and now the python test code shows, as expected:
pi@occberry ~/OpenCyclingComputer $ sudo python src/mma8451.py
26
[1] www.adafruit.com/products/2019
[2] www.raspberrypi.org/forums/viewtopic.php?f=44&t=15840&start=25