Skip to content

Commit 0b6b804

Browse files
committed
More detailed readme
1 parent 6e917b2 commit 0b6b804

File tree

1 file changed

+47
-2
lines changed

1 file changed

+47
-2
lines changed

README.md

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,54 @@
1-
# TM1637
21
# MicroPython TM1637
32

4-
A MicroPython library for the quad 7-segment LED display modules based on the TM1637 LED driver.
3+
A MicroPython library for quad 7-segment LED display modules using the TM1637 LED driver.
54

65
For example, the [Grove - 4 Digit Display module](http://wiki.seeed.cc/Grove-4-Digit_Display/)
76

87
![demo](docs/demo.jpg)
98

9+
## Examples
10+
11+
Copy the file to your device, using ampy, webrepl or compiling and deploying. eg.
12+
13+
```
14+
$ ampy put tm1637.py
15+
```
16+
17+
**Basic usage**
18+
19+
```
20+
import tm1637
21+
from machine import Pin
22+
tm = tm1637.TM1637(clk=Pin(5), dio=Pin(4))
23+
24+
# all LEDS on "88:88"
25+
tm.write([127, 255, 127, 127])
26+
27+
# all LEDS off
28+
tm.write([0, 0, 0, 0])
29+
30+
# display "0123"
31+
tm.write([63, 6, 91, 79])
32+
33+
# show "COOL"
34+
tm.write([0b00111001, 0b00111111, 0b00111111, 0b00111000])
35+
36+
# display "dEAd", "bEEF"
37+
tm.hex(0xdead)
38+
tm.hex(0xbeef)
39+
40+
# show "12:59"
41+
tm.numbers(12,59)
42+
43+
# show "-123"
44+
tm.number(-123)
45+
46+
# show temperature '24*C'
47+
tm.temperature(24)
48+
```
49+
50+
For more detailed examples, see ![tm1637_test.py](tm1637_test.py)
51+
1052
They are called 7-segment displays as there are 7 LEDs for each digit (segment).
1153
One byte (7 lower bits) for each segment. The 8th bit (MSB) is for the colon and only on the 2nd segment.
1254

@@ -63,4 +105,7 @@ G | GND
63105

64106
* [WeMos D1 Mini](http://www.wemos.cc/Products/d1_mini.html)
65107
* [micropython.org](http://micropython.org)
108+
* [TM1637 datasheet](http://www.titanmec.com/index.php/en/project/download/id/302.html)
109+
* [Titan Micro TM1637 product page](http://www.titanmec.com/index.php/en/project/view/id/302.html)
66110
* [Nokia 5110 version](https://github.com/mcauser/MicroPython-ESP8266-Nokia-5110-Quad-7-segment)
111+
* [Adafruit Ampy](https://learn.adafruit.com/micropython-basics-load-files-and-run-code/install-ampy)

0 commit comments

Comments
 (0)