File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change 11import time
22import board
33import busio
4- from adafruit_lis331 import *
4+ import adafruit_lis331
55
66i2c = busio .I2C (board .SCL , board .SDA )
77# un-comment the sensor you are using
88# lis = H3LIS331(i2c)
9- lis = LIS331HH (i2c )
9+ lis = adafruit_lis331 . LIS331HH (i2c )
1010
1111# use a nice fast data rate to for maximum resolution
12- lis .data_rate = Rate .RATE_1000_HZ
12+ lis .data_rate = adafruit_lis331 . Rate .RATE_1000_HZ
1313
1414# enable the high pass filter without a reference or offset
15- lis .enable_hpf (True , cutoff = RateDivisor .ODR_DIV_100 , use_reference = False )
15+ lis .enable_hpf (
16+ True , cutoff = adafruit_lis331 .RateDivisor .ODR_DIV_100 , use_reference = False
17+ )
1618
1719# you can also uncomment this section to set and use a reference to offset the measurements
1820# lis.hpf_reference = 50
Original file line number Diff line number Diff line change 11import time
22import board
33import busio
4- from adafruit_lis331 import *
4+ from adafruit_lis331 import LIS331HH , Rate , Frequency
55
66i2c = busio .I2C (board .SCL , board .SDA )
77
1111
1212# `data_rate` must be a `LOWPOWER` rate to use the low-pass filter
1313lis .data_rate = Rate .RATE_LOWPOWER_10_HZ
14- # next set the cutoff frequency. Anything changing faster than the specified frequency will be filtered out
14+ # next set the cutoff frequency. Anything changing faster than
15+ # the specified frequency will be filtered out
1516lis .lpf_cutoff = Frequency .FREQ_74_HZ
1617
17- # Once you've seen the filter do its thing, you can comment out the lines above to use the default data rate
18- # without the low pass filter and see the difference it makes
18+ # Once you've seen the filter do its thing, you can comment out the
19+ # lines above to use the default data rate without the low pass filter
20+ # and see the difference it makes
1921
2022while True :
2123 print (lis .acceleration ) # plotter friendly printing
You can’t perform that action at this time.
0 commit comments