I2C programming in Accelerometer

Hi, I’m working on two accelerometers, both of them are digital (ADXL345 by sparkfun) and I’m having trouble programming them to display the X, Y and Z axis. I’m trying the code in python first because its alot easier to work with and much faster to learn than C++ but I haven’t had much luck in finding tutorials that make sense. Derek Molloys tutorial of the same topic is good but it comes with some problems that I’m unable to solve. He requires to install a number of other packages that are temporarily unavailable online for downloading into my BBB so I have to result to alternate ideas and code examples. Can someone please kindly direct me to a sample code that I can try out?
Thanks

you can use for i2c with python the adafruit library fro the beaglebone or if you like to use nodejs there is node-i2c. I used node-i2c to make a custom driver for the ds1337 rtc and it worked pretty nice.

-Pedro

http://learn.adafruit.com/setting-up-io-python-library-on-beaglebone-black/i2c
https://github.com/kelly/node-i2c

Thanks for the advice and the links! So, I noticed that the ADXL345 is made in the node-i2c github as a project. There are a number of files in it, so the one that has the code for the working of the accelerometer is the one that is labeled “index.js”? also since I haven’t made a code in the .js format, is this done from the terminal or from the cloud9ide? thanks again!

Same as python, just write ‘node scriptname.js’. I’m not sure if you can use run it from cloud9

-Pedro

I made the code for the z axis of the accelerometer but i just need some help on how to adjust it for the X and Y axis. Heres the sample code for the z axis.

Im here with the same problem did you ever find a solution?