-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from siddacious/master
Adding active, dropped, and tapped for #3
- Loading branch information
Showing
5 changed files
with
299 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import time | ||
import board | ||
import busio | ||
import adafruit_adxl34x | ||
|
||
i2c = busio.I2C(board.SCL, board.SDA) | ||
|
||
accelerometer = adafruit_adxl34x.ADXL345(i2c) | ||
accelerometer.enable_freefall_detection() | ||
# alternatively you can specify attributes when you enable freefall detection for more control: | ||
# accelerometer.enable_freefall_detection(threshold=10,time=25) | ||
while True: | ||
print("%f %f %f"%accelerometer.acceleration) | ||
|
||
print("Dropped: %s"%accelerometer.events["freefall"]) | ||
time.sleep(0.5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import time | ||
import board | ||
import busio | ||
import adafruit_adxl34x | ||
|
||
i2c = busio.I2C(board.SCL, board.SDA) | ||
|
||
accelerometer = adafruit_adxl34x.ADXL345(i2c) | ||
accelerometer.enable_motion_detection() | ||
# alternatively you can specify the threshold when you enable motion detection for more control: | ||
# accelerometer.enable_motion_detection(threshold=10) | ||
while True: | ||
print("%f %f %f"%accelerometer.acceleration) | ||
|
||
print("Motion detected: %s"%accelerometer.events['motion']) | ||
time.sleep(0.5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import time | ||
import board | ||
import busio | ||
import adafruit_adxl34x | ||
|
||
i2c = busio.I2C(board.SCL, board.SDA) | ||
|
||
accelerometer = adafruit_adxl34x.ADXL345(i2c) | ||
accelerometer.enable_tap_detection() | ||
# you can also configure the tap detection parameters when you enable tap detection: | ||
# accelerometer.enable_tap_detection(tap_count=2,threshold=20, duration=50) | ||
while True: | ||
print("%f %f %f"%accelerometer.acceleration) | ||
|
||
print("Tapped: %s"%accelerometer.events['tap']) | ||
time.sleep(0.5) |