-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* some-update: accept seesaw pins or microcontroller.Pin, add 4 digit example
- Loading branch information
Showing
5 changed files
with
78 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# SPDX-FileCopyrightText: Copyright (c) 2023 Neradoc | ||
# | ||
# SPDX-License-Identifier: Unlicense | ||
|
||
""" | ||
4-digits 7-segments display with default order. | ||
""" | ||
|
||
import time | ||
import board | ||
from tm1637_display import TM1637Display | ||
|
||
display = TM1637Display(board.GP13, board.GP12, length=4, digit_order=(0, 1, 2, 3)) | ||
|
||
message = " 3141592653589793 " | ||
|
||
while True: | ||
for i in range(5): | ||
display.print("0000") | ||
time.sleep(0.1) | ||
display.print(" ") | ||
time.sleep(0.1) | ||
|
||
for pos in range(len(message) - 4): | ||
display.print(message[pos : pos + 4]) | ||
time.sleep(0.2) | ||
|
||
for i in range(0, 10000, 7): | ||
display.print(f"{i:4}") | ||
display.print(9999) | ||
|
||
time.sleep(0.2) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# SPDX-FileCopyrightText: Copyright (c) 2023 Neradoc | ||
# | ||
# SPDX-License-Identifier: Unlicense | ||
|
||
import time | ||
import board | ||
from tm1637_display import TM1637Display | ||
|
||
display = TM1637Display(board.SCL, board.SDA, length=6, digit_order=(2, 1, 0, 5, 4, 3)) | ||
DELAY = 0.5 | ||
|
||
message = " 3141592653589793 " | ||
|
||
while True: | ||
for i in range(5): | ||
display.print("000000") | ||
time.sleep(0.1) | ||
display.print(" ") | ||
time.sleep(0.1) | ||
|
||
for pos in range(len(message) - 6): | ||
display.print(message[pos : pos + 6]) | ||
time.sleep(0.2) | ||
|
||
for i in range(0, 1_000_000, 7): | ||
display.print(f"{i:4}") | ||
display.print(9999) | ||
|
||
time.sleep(0.2) |
This file contains 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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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