Accelerometer not returning values

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
Yadnik
Posts: 65
Joined: Thu May 13, 2021 6:01 am

Accelerometer not returning values

Post by Yadnik » Mon Aug 16, 2021 3:20 pm

I am using the Accel 10 click housing the LIS2DW12TR accelerometer and I want to run it using a MicroPython program.The code is as follows:https://github.com/Yadnik1/Accel10I2C/b ... ADXL345.py. The code prints out 0s abruptly and I am skeptical there I am making some mistake in the init function for enabling the accelerometer by writing to control register.

My init function is as follows:

def __init__(self,i2c,addr=device):
self.addr = addr
self.i2c = i2c
b = bytearray(1)
b[0] = 0
self.i2c.writeto_mem(self.addr,0x20,b)
b[0] = 16
self.i2c.writeto_mem(self.addr,0x20,b)
Can someone please tell me where I may be going wrong.
Datasheet of LIS2DW12TR:https://download.mikroe.com/documents/d ... asheet.pdf
Thank you very much.
Device address is :0x18
Control register is:0x20
Register address to read from is :0x28

Post Reply