|
1 |
| -# 8x8 LED Matrix |
| 1 | +# MAX7219 8x8 LED Matrix |
2 | 2 |
|
3 |
| -This is a low-cost and easy-to-program device that is perfect for small projects. |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | +This is a low-cost ($3) and easy-to-program device that is perfect for small projects that don't |
| 7 | +need a full graphical display. You will be surprised at how creative our students are with |
| 8 | +just an 8x8 display! |
| 9 | + |
| 10 | +[eBay Search for "MAX7219 8x8 matrix"](https://www.ebay.com/sch/i.html?_nkw=MAX7219+8x8+matrix) |
| 11 | + |
| 12 | +The device comes with five connectors: |
| 13 | + |
| 14 | +1. Power (VCC) |
| 15 | +2. Ground (GND) |
| 16 | +3. Clock (SCK) |
| 17 | +4. Data (MOSI) |
| 18 | +5. Chip Select (CS) |
| 19 | + |
| 20 | +We can communicate with the device using the standard SPI interface. There is also |
| 21 | +an 8x8 driver supplied by [Mike Causer](https://github.com/mcauser/micropython-max7219) Here is an excerpt of how we |
| 22 | +configured the driver to use a single display: |
| 23 | + |
| 24 | +```py |
| 25 | +from machine import SPI, Pin |
| 26 | +import max7219 |
| 27 | +from utime import sleep |
| 28 | +CLOCK_PIN = 2 |
| 29 | +DATA_PIN = 3 |
| 30 | +CS_PIN = 4 |
| 31 | +spi0=SPI(0,baudrate=10000000, polarity=1, phase=0, sck=Pin(CLOCK_PIN), mosi=Pin(DATA_PIN)) |
| 32 | +cs = Pin(CS_PIN, Pin.OUT) |
| 33 | +matrix = max7219.Matrix8x8(spi0, cs , 1) |
| 34 | +# display text a x=0, y=0 and state = 1 (on) |
| 35 | +matrix.text('1234', 0, 0, 1) |
| 36 | +matrix.show() |
| 37 | +``` |
| 38 | + |
| 39 | +You can change the last parameter from "1" to "4" if you have 4 displays wired together: |
| 40 | + |
| 41 | +```py |
| 42 | +import max7219 |
| 43 | +from machine import Pin, SPI |
| 44 | +spi = SPI(1) |
| 45 | +matrix = max7219.Matrix8x8(spi0, cs , 4) |
| 46 | +display.text('1234',0,0,1) |
| 47 | +display.show() |
| 48 | +``` |
| 49 | + |
| 50 | +The displays can also be "cascaded" |
4 | 51 |
|
5 | 52 | ## Basic Program
|
6 | 53 |
|
|
0 commit comments