Skip to content
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

Adds digital clock example for pico_display #531

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

hoganri
Copy link

@hoganri hoganri commented Oct 5, 2022

Starts at 12:00 and allows the user to adjust the hours/minutes using the pico_display buttons

Starts at 12:00 and allows the user to adjust the hours/minutes using the pico_display buttons
@Gadgetoid
Copy link
Member

Thank you!

You should keep currentTimeHours and currentTimeMinutes as integers, and use Python's string formatting to display and right-justify them. EG:

>>> "{:02}:{:02}".format(9, 30)
'09:30'

That would save a lot of unnecessary conversion to/from int.

There are also a few linting errors, which our CI will tell you about here - https://github.com/pimoroni/pimoroni-pico/actions/runs/3193502590/jobs/5218789053

There's also a clock example for Badger 2040 which you might want to draw inspiration from - https://github.com/pimoroni/pimoroni-pico/blob/main/micropython/examples/badger2040/clock.py

Fixes linting errors and removes unnecessary type conversions. Time adjustments also moved into individual functions.
@hoganri
Copy link
Author

hoganri commented Oct 7, 2022

Thanks for the feedback. I believe each of these items are addressed in the new commit.

@ZodiusInfuser ZodiusInfuser added [- pico display pack -] https://shop.pimoroni.com/products/pico-display-pack micropython This issue or request relates to micropython (either code or bindings) labels Jan 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[- pico display pack -] https://shop.pimoroni.com/products/pico-display-pack micropython This issue or request relates to micropython (either code or bindings)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants