An ArduPy library for 3-Axis Digital Accelerometer ±2g to 16g (LIS3DHTR).Acceleration data can be obtained using IIC interface.
- Install AIP
pip3 install aip
- Build firmware with Seeed ArduPy LIS3DHTR
aip install https://github.com/Seeed-Studio/seeed-ardupy-lis3dhtr
aip build
- Flash new firmware to you ArduPy board
aip flash [Ardupy Bin PATH]
For more examples of using AIP, please refer to AIP.
from machine import Map
from arduino import grove_lis3dhtr
lis = grove_lis3dhtr()
#lis = grove_lis3dhtr(Map.WIRE1) #Specify wire
while True:
if lis.avaiable():
print("X: ", lis.x)
print("Y: ", lis.y)
print("Z: ", lis.z)
- available(void) : bool - available
if lis.available():
print("X: " + lis.x)
- setPoweMode(mode<uint8_t>) : void - set power mode
# Set power mode
lis.setPoweMode(0) #POWER_MODE_NORMAL
lis.setPoweMode(1) #POWER_MODE_LOW
- setFullScaleRange(range<uint8_t>) : void - set full scale range
lis.setFullScaleRange(0) # LIS3DHTR_RANGE_2G
lis.setFullScaleRange(1) # LIS3DHTR_RANGE_4G
lis.setFullScaleRange(2) # IS3DHTR_RANGE_8G
lis.setFullScaleRange(3) # LIS3DHTR_RANGE_16G
- setOutputDataRate(rate<uint8_t>) : void - set output data rate
lis.setOutputDataRate(0) # LIS3DHTR_DATARATE_POWERDOWN
lis.setOutputDataRate(1) # LIS3DHTR_DATARATE_1HZ
lis.setOutputDataRate(2) # LIS3DHTR_DATARATE_10HZ
lis.setOutputDataRate(3) # LIS3DHTR_DATARATE_25HZ
lis.setOutputDataRate(4) # LIS3DHTR_DATARATE_50HZ
lis.setOutputDataRate(5) # LIS3DHTR_DATARATE_100HZ
lis.setOutputDataRate(6) # LIS3DHTR_DATARATE_200HZ
lis.setOutputDataRate(7) # LIS3DHTR_DATARATE_400HZ
lis.setOutputDataRate(8) # LIS3DHTR_DATARATE_1_6KH
lis.setOutputDataRate(9) # LIS3DHTR_DATARATE_5KHZ
- setHighSolution(rate<bool>) : void set high solution
lis.setHighSolution(True) # HighSolution enable
lis.setHighSolution(False) # HighSolution disable
- openTemp(void) : void - open temperature enable
lis.openTemp()
- closeTemp(void) : void - close temperature enable
lis.closeTemp()
- getAcceleration(void) : list(float) - get acceleration x, y and z
x,y,z = lis.getAcceleration()
- x : float - get acceleration z
x = lis.x
- y : float - get acceleration y
y = lis.y
- z : float - get acceleration z
z = lis.z
- adc1 : uint16_t - get adc channle 1
adc1 = lis.adc1
- adc2 : uint16_t - get adc channle 2
adc2 = lis.adc2
- adc3 : uint16_t - get adc channle 3
adc3 = lis.adc3
- temperature : uint16_t - get temperature
temperature = lis.temperature
This software is written by seeed studio
and is licensed under The MIT License. Check License.txt for more information.
Contributing to this software is warmly welcomed. You can do this basically by
forking, committing modifications and then pulling requests (follow the links above
for operating guide). Adding change log and your contact into file header is encouraged.
Thanks for your contribution.
Seeed Studio is an open hardware facilitation company based in Shenzhen, China.
Benefiting from local manufacture power and convenient global logistic system,
we integrate resources to serve new era of innovation. Seeed also works with
global distributors and partners to push open hardware movement.