Skip to content

Commit 9f11177

Browse files
authored
Merge pull request #42 from tekktrik/doc/update-example-pins
Update examples to more expected pinout
2 parents 3e49400 + c3849b9 commit 9f11177

File tree

4 files changed

+13
-74
lines changed

4 files changed

+13
-74
lines changed

README.rst

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -56,62 +56,7 @@ To install in a virtual environment in your current project:
5656
Usage Example
5757
=============
5858

59-
adafruit_max7219.Matrix8x8 Example
60-
----------------------------------
61-
62-
.. code-block:: python
63-
64-
from adafruit_max7219 import matrices
65-
from board import TX, RX, A2
66-
import busio
67-
import digitalio
68-
import time
69-
70-
clk = RX
71-
din = TX
72-
cs = digitalio.DigitalInOut(A2)
73-
74-
spi = busio.SPI(clk, MOSI=din)
75-
display = matrices.Matrix8x8(spi, cs)
76-
while True:
77-
display.brightness(3)
78-
79-
display.fill(1)
80-
display.pixel(3, 3)
81-
display.pixel(3, 4)
82-
display.pixel(4, 3)
83-
display.pixel(4, 4)
84-
display.show()
85-
time.sleep(3.0)
86-
87-
display.clear_all()
88-
s = 'Hello, World!'
89-
for c in range(len(s)*8):
90-
display.fill(0)
91-
display.text(s,-c,0)
92-
display.show()
93-
time.sleep(0.25)
94-
95-
96-
adafruit_max7219.BCDDigits Example
97-
----------------------------------
98-
99-
.. code-block:: python
100-
101-
from adafruit_max7219 import bcddigits
102-
from board import TX, RX, A2
103-
import bitbangio
104-
import digitalio
105-
106-
clk = RX
107-
din = TX
108-
cs = digitalio.DigitalInOut(A2)
109-
110-
spi = bitbangio.SPI(clk, MOSI=din)
111-
display = bcddigits.BCDDigits(spi, cs, nDigits=8)
112-
display.clear_all()
113-
display.show_str(0,'{:9.2f}'.format(-1234.56))
114-
display.show()
59+
See the ``examples/`` folder example uses of this library.
11560

11661
Documentation
11762
=============

examples/max7219_custommatrixtest.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22
# SPDX-License-Identifier: MIT
33

44
import time
5-
from board import TX, RX, A1
6-
import busio
5+
import board
76
import digitalio
87
from adafruit_max7219 import matrices
98

10-
mosi = TX
11-
clk = RX
12-
cs = digitalio.DigitalInOut(A1)
139

14-
spi = busio.SPI(clk, MOSI=mosi)
10+
# You may need to change the chip select pin depending on your wiring
11+
spi = board.SPI()
12+
cs = digitalio.DigitalInOut(board.D4)
1513

1614
matrix = matrices.CustomMatrix(spi, cs, 32, 8)
1715
while True:

examples/max7219_showbcddigits.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@
33

44
import time
55
import random
6-
from board import TX, RX, A1
7-
import busio
6+
import board
87
import digitalio
98
from adafruit_max7219 import bcddigits
109

11-
mosi = TX
12-
clk = RX
13-
cs = digitalio.DigitalInOut(A1)
1410

15-
spi = busio.SPI(clk, MOSI=mosi)
11+
# You may need to change the chip select pin depending on your wiring
12+
spi = board.SPI()
13+
cs = digitalio.DigitalInOut(board.D4)
1614

1715
leds = bcddigits.BCDDigits(spi, cs, nDigits=8)
1816
while True:

examples/max7219_simpletest.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22
# SPDX-License-Identifier: MIT
33

44
import time
5-
from board import TX, RX, A1
6-
import busio
5+
import board
76
import digitalio
87
from adafruit_max7219 import matrices
98

10-
mosi = TX
11-
clk = RX
12-
cs = digitalio.DigitalInOut(A1)
139

14-
spi = busio.SPI(clk, MOSI=mosi)
10+
# You may need to change the chip select pin depending on your wiring
11+
spi = board.SPI()
12+
cs = digitalio.DigitalInOut(board.D4)
1513

1614
matrix = matrices.Matrix8x8(spi, cs)
1715
while True:

0 commit comments

Comments
 (0)