Created
February 2, 2021 21:59
-
-
Save frijole/b1707b0d144f0caa13df5cae2951f174 to your computer and use it in GitHub Desktop.
sample of work-in-progress library for artdsb projects (http://frijole.info/art-dsb/)
This file contains hidden or 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
| def show_sample_loop(): | |
| matrix = artdsb_led.api_get_display() | |
| draw, image = artdsb_led.api_get_drawing() | |
| ttfFont = load_font() | |
| artdsb_led.api_clear_screen(draw) | |
| artdsb_led.api_draw_text(draw, ttfFont, "Ready.") | |
| artdsb_led.api_display_image(image, matrix) | |
| iteration = 0 | |
| iterationLimit = 4 | |
| lastIteration = datetime.datetime.now() | |
| iterationTimer = 5 # seconds | |
| while True: | |
| artdsb_led.api_clear_screen(draw) | |
| now = datetime.datetime.now() | |
| timeSinceIteration = now - lastIteration | |
| if timeSinceIteration.total_seconds() >= iterationTimer: | |
| iteration = (iteration + 1) % 4 | |
| lastIteration = now | |
| iterationText = ["one", "twoo", "threee", "chomp"][iteration] | |
| artdsb_led.api_draw_text(draw, ttfFont, iterationText) | |
| artdsb_led.api_display_image(image, matrix) | |
| time.sleep(0.005) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment