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 1
1
import time
2
2
import board
3
3
import busio
4
- from adafruit_lis331 import *
4
+ import adafruit_lis331
5
5
6
6
i2c = busio .I2C (board .SCL , board .SDA )
7
7
# un-comment the sensor you are using
8
8
# lis = H3LIS331(i2c)
9
- lis = LIS331HH (i2c )
9
+ lis = adafruit_lis331 . LIS331HH (i2c )
10
10
11
11
# 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
13
13
14
14
# 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
+ )
16
18
17
19
# you can also uncomment this section to set and use a reference to offset the measurements
18
20
# lis.hpf_reference = 50
Original file line number Diff line number Diff line change 1
1
import time
2
2
import board
3
3
import busio
4
- from adafruit_lis331 import *
4
+ from adafruit_lis331 import LIS331HH , Rate , Frequency
5
5
6
6
i2c = busio .I2C (board .SCL , board .SDA )
7
7
11
11
12
12
# `data_rate` must be a `LOWPOWER` rate to use the low-pass filter
13
13
lis .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
15
16
lis .lpf_cutoff = Frequency .FREQ_74_HZ
16
17
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
19
21
20
22
while True :
21
23
print (lis .acceleration ) # plotter friendly printing
You can’t perform that action at this time.
0 commit comments