Question
Stm32f302 interface to Adxl345
Posted on August 29, 2017 at 22:02
Hello everyone I am trying to interface acceleration sensor Adxl345 to stm32f302 through I2C using the HAL Library. Actually I am learning the programming , does any one help me how to get the data from sensor. I wrote this code , it does not work it.
void adxl345_data(void)
{
uint8_t data[2]; int x ; int data_1; char buff[100]; HAL_I2C_Mem_Read(&hi2c3, 0x53<<1, 0x32, I2C_MEMADD_SIZE_8BIT, (uint8_t*)data, 2, 1000); x = ( data[1]<<8) |data[0];}
could you give me idea where is mistake ?