-
Notifications
You must be signed in to change notification settings - Fork 71
Added shake detection #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for adding this! A few comments and then it'll be good.
|
||
while True: | ||
if shake(): | ||
print("Shake detected!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is missing an indent.
|
||
while True: | ||
if shake(shake_threshold=20): | ||
print("Shake detected more easily than before!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here too.
from adafruit_circuitplayground.express import cpx | ||
|
||
while True: | ||
if shake(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cpx.shake()
here and below
@@ -88,6 +88,39 @@ def acceleration(self): | |||
""" | |||
return self._lis3dh.acceleration | |||
|
|||
@property |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be a property because the implementation sleeps. So, remove property here and below return self._lis3dh.shake()
. Right now you are actually returning the underlying function as the value of the property and then calling it. After the changes you'll return the value itself.
Looks great! Thank you! |
Updating https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground to 0.9.0 from 0.8.1: > Added error to cpx.shake for incompatible CircuitPython versions (adafruit/Adafruit_CircuitPython_CircuitPlayground#19) > Removed unnecessary lis3dh lines from init > Merge pull request adafruit/Adafruit_CircuitPython_CircuitPlayground#17 from chickadee-tech/lint > Added .frozen to sys path to prefer frozen modules > Added shake detection (adafruit/Adafruit_CircuitPython_CircuitPlayground#15) > Doc updates, global brightness included.
Updated typo as well.