sunfounder/Sunfounder_SuperKit_Python_code_for_RaspberryPi

ADXL345 - Raspberry Pi 3

Opened this issue · 2 comments

hello, when running the example python script for the ADXL345 it generates:

IOERROR: [Errno 2] No Such File Or Directory

  1. With the ic2tools installed it shows the ADXL on address 53 when you run ic2detect
  2. I2C is enabled by Raspi-Config and restarted
  3. ADX345 hardware returns value if using another script to talk to the ADX345, the latest Sunfounder script does not work
  4. Error occurs with latest Python 2.x version

Hi, Uruwashii.

Sorry about your problem. It's the Adafruit I2C module did not support auto detect bus number on Pi 3 yet. You can fix it with one of the options below:

Option 1. Go to Adafruit's Github repository, and check if they fix it yet, if it does, replace the Adafruit I2C.py file with the new one in directory: 14_ADXL345/Adafruit_ADXL345/.

Option 2: force the bus number to 1
Edit file: Adafruit_ADXL345.py:
nano Adafruit_ADXL345.py
find line like below, (It's about line 109):
accel = Adafruit_ADXL345()
change it to:
accel = Adafruit_ADXL345(busnum=1)
Hit CTRL + X to exit and than Y to save it.

The option 2 is recommended if you are new. And we did not test the change yet, but it should work. Reply or email us, if it doesn't.

Cavon from SunFounder

I ran in the same issue and what I missed was to activate the I2C interface / kernel module in raspi-config.
sudo raspi-config => Interace options => I2C

(I know, a blast from the past, but maybe there are others out there discovering that little treasure this sunfounder box is years after buying it)