Skip to content

Create “Gravity Pulls Pixel” program #67

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 4 commits into from
Aug 19, 2019

Conversation

dcbriccetti
Copy link
Contributor

This program uses the Circuit Playground Express’s accelerometer to position
a white pixel as if gravity were pulling it.

This may be too complicated to belong here. Please let me know if it is, and if there’s somewhere else within Adafruit where it could be useful. Otherwise I’ll just publish it within my own sphere.

Video here: https://youtu.be/sZ4tNOUKRpw

@tannewt tannewt requested a review from kattni August 13, 2019 19:06
Copy link
Contributor

@kattni kattni 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 submitting this! Please create a folder called Advanced Examples within the examples folder and move this file into that. There's definitely a place for it here, we simply need to create it!

As well the linting checks have failed through Travis on a couple of things. Please ping me if you need assistance with working through this.

@dcbriccetti
Copy link
Contributor Author

Hi Kattni. How about we call the subfolder advanced, since examples is lower case, and it’s inside a folder examples we already know it’s examples?

@dcbriccetti
Copy link
Contributor Author

dcbriccetti commented Aug 13, 2019

The style check doesn’t like

    smaller = min(a1, a2)
    larger  = max(a1, a2)

But don’t we prefer that to:

    smaller = min(a1, a2)
    larger = max(a1, a2)

The other thing it didn’t like was a function’s formal parameters shadowing variables in the module scope. I got around it this time by renaming the module-level variables. Other solutions would be to disable the check, or move most of the top-level code into a new function so that those variables have function scope (as I did in another program, where you asked about it). For my own purposes, I would probably allow the variable shadowing, but I’m happy to fit in here with the way you like to do things.

@kattni
Copy link
Contributor

kattni commented Aug 13, 2019

I would prefer it be called advanced examples. I understand it is already in the examples folder, but I feel being more explicit is better. Lowercase is fine.

Having things lined up is a personal preference, however if you choose to do so, you must disable the pylint checks. I personally don't bother with lining things up, I go with proper spacing, but that is my preference.

@dcbriccetti
Copy link
Contributor Author

I rebased to combine commits, and force pushed. If this passes, it’s ready as far as I’m concerned. Thanks!

Copy link
Contributor

@kattni kattni 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 so much!

For the record, we don't mind long commit lists. :)

@dcbriccetti
Copy link
Contributor Author

I don’t understand the Travis error. Also, is the space in advanced examples OK?

@kattni
Copy link
Contributor

kattni commented Aug 13, 2019

Space should be ok, but we can underscore it instead for consistency. I don't think that's the issue. I think the issue is in how Travis looks to run pylint on the files. I believe we'll need to update .travis.yml. Give me a bit here to sort this out.

@kattni
Copy link
Contributor

kattni commented Aug 13, 2019

@dcbriccetti Ok I need to get some help on this one. I know what needs to happen but not entirely how to do it, and I believe that we need to update some further tools to deal with a subfolder. This is something I believe we would have eventually needed to do anyway, it happens to be that you're the first test case for it! I appreciate your patience. I'll keep you posted.

@dcbriccetti
Copy link
Contributor Author

Sure! No rush. Glad to help you stretch things.

@kattni
Copy link
Contributor

kattni commented Aug 16, 2019

@dcbriccetti Still looking into this, haven't been able to coordinate with the person I need to yet. Wanted to give you an update.

@dcbriccetti
Copy link
Contributor Author

Thanks. That’s thoughtful.

@kattni
Copy link
Contributor

kattni commented Aug 17, 2019

@dcbriccetti Please make the following change to .travis.yml:
Replace line 30

  - ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name examples/*.py)

with

  - ([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name `find ./examples -name "*.py"`)

And let's see if that appeases Travis!

@kattni
Copy link
Contributor

kattni commented Aug 17, 2019

@dcbriccetti Thank you for making the change. I'm looking into this further.

@kattni
Copy link
Contributor

kattni commented Aug 19, 2019

Thanks for your patience! We've sorted it.

@kattni kattni merged commit d7f8814 into adafruit:master Aug 19, 2019
@dcbriccetti
Copy link
Contributor Author

Hurray!

@ladyada
Copy link
Member

ladyada commented Aug 19, 2019

yayy!

@siddacious
Copy link

🎉 🎉 HUZZAH! 🎉 🎉

adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Aug 19, 2019
@dcbriccetti dcbriccetti deleted the gravity_pulls_pixel branch September 30, 2019 17:10
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.

4 participants