File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ """ This example shows off how to use the step counter built
2
+ into the ST LSM6DS series IMUs. The steps are calculated in
3
+ the chip so you don't have to do any calculations!"""
4
+
5
+ import time
6
+ import board
7
+ import busio
8
+ from adafruit_lsm6ds import LSM6DS33 , Rate , AccelRange
9
+
10
+ i2c = busio .I2C (board .SCL , board .SDA )
11
+
12
+ sensor = LSM6DS33 (i2c )
13
+
14
+ # enable accelerometer sensor @ 2G and 26 Hz
15
+ sensor .accelerometer_range = AccelRange .RANGE_2G
16
+ sensor .accelerometer_data_rate = Rate .RATE_26_HZ
17
+ # no gyro used for step detection
18
+ sensor .gyro_data_rate = Rate .RATE_SHUTDOWN
19
+
20
+ #enable the pedometer
21
+ sensor .pedometer_enable (True )
22
+
23
+ while True :
24
+ print ("Steps: " , sensor .pedometer_steps )
25
+ time .sleep (1 )
You can’t perform that action at this time.
0 commit comments