Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years ago.
ADXL345 problem
Thanks for watching my question! i use ADXL345 (I2C) and my board is LPC4088 i have some problems. this is the ADXL345.cpp and .h. i use below https://developer.mbed.org/users/gltest26/code/ADXL345/file/122a504fcfa3/ADXL345.cpp
this is my code
and the putty always display
what's wrong? thanks
1 Answer
9 years ago.
A few ideas:
1) Do you have the required pull-up resistors for the I2C lines ? The value for the resistors is not critical and can be 2k to 10k for each but are required for I2C interfacing.
2) Assuming you have the pull-up resistors, check your ID for this target sensor. From a quick search, the ID for this sensor in your code does not match what other developers are using.
See here:
// read or write bytes #define ADXL345_I2C_READ 0xA7 #define ADXL345_I2C_WRITE 0xA6 #define ADXL345_I2C_ADDRESS 0x53 //the ADXL345 7-bit address is 0x53 when ALT ADDRESS is low as it is on the sparkfun chip: when ALT ADDRESS is high the address is 0x1D /////////////when ALT ADDRESS pin is high: //#define ADXL345_I2C_READ 0x3B //#define ADXL345_I2C_WRITE 0x3A //#define ADXL345_I2C_ADDRESS 0x1D
Reference: https://developer.mbed.org/users/peterswanson87/code/ADXL345_I2C/
If you continue to have problems, then post more details of your wiring diagram and schematic if available for this sensor.