Skip to content

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

Merged
merged 2 commits into from
Nov 29, 2017
Merged

Added shake detection #15

merged 2 commits into from
Nov 29, 2017

Conversation

kattni
Copy link
Contributor

@kattni kattni commented Nov 27, 2017

Updated typo as well.

@tannewt tannewt self-requested a review November 28, 2017 18:18
Copy link
Member

@tannewt tannewt left a 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!")
Copy link
Member

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!")
Copy link
Member

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():
Copy link
Member

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
Copy link
Member

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.

@tannewt
Copy link
Member

tannewt commented Nov 29, 2017

Looks great! Thank you!

@tannewt tannewt merged commit 11ca7a2 into adafruit:master Nov 29, 2017
tannewt pushed a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Dec 8, 2017
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.
@kattni kattni deleted the shake-detect branch June 27, 2018 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants