|
7 | 7 |
|
8 | 8 | # Initialize SPI bus and control pins
|
9 | 9 | spi = busio.SPI(board.SCK, MOSI=board.MOSI)
|
10 |
| -dc = digitalio.DigitalInOut(board.D5) # data/command |
11 |
| -cs = digitalio.DigitalInOut(board.D6) # Chip select |
12 |
| -reset = digitalio.DigitalInOut(board.D7) # reset |
| 10 | +dc = digitalio.DigitalInOut(board.D6) # data/command |
| 11 | +cs = digitalio.DigitalInOut(board.D5) # Chip select |
| 12 | +reset = digitalio.DigitalInOut(board.D9) # reset |
13 | 13 |
|
14 | 14 | display = adafruit_pcd8544.PCD8544(spi, dc, cs, reset)
|
15 |
| -display.bias = 5 |
16 |
| -display.contrast = 100 |
| 15 | + |
| 16 | +display.bias = 4 |
| 17 | +display.contrast = 60 |
| 18 | + |
| 19 | +# Turn on the Backlight LED |
| 20 | +backlight = digitalio.DigitalInOut(board.D10) # backlight |
| 21 | +backlight.switch_to_output() |
| 22 | +backlight.value = True |
17 | 23 |
|
18 | 24 | print("Pixel test")
|
19 | 25 | # Clear the display. Always call show after changing pixels to make the display
|
|
28 | 34 | # Set a pixel in the opposite corner position.
|
29 | 35 | display.pixel(display.width-1, display.height-1, 1)
|
30 | 36 | display.show()
|
31 |
| -time.sleep(0.1) |
| 37 | +time.sleep(2) |
32 | 38 |
|
33 | 39 | print("Lines test")
|
34 | 40 | # we'll draw from corner to corner, lets define all the pair coordinates here
|
|
41 | 47 | display.line(corner_from[0], corner_from[1],
|
42 | 48 | corner_to[0], corner_to[1], 1)
|
43 | 49 | display.show()
|
44 |
| -time.sleep(0.1) |
| 50 | +time.sleep(2) |
45 | 51 |
|
46 | 52 | print("Rectangle test")
|
47 | 53 | display.fill(0)
|
|
50 | 56 | for i in range(11):
|
51 | 57 | display.rect(0, 0, int(w_delta*i), int(h_delta*i), 1)
|
52 | 58 | display.show()
|
53 |
| -time.sleep(0.1) |
| 59 | +time.sleep(2) |
54 | 60 |
|
55 | 61 | print("Text test")
|
56 | 62 | display.fill(0)
|
57 | 63 | display.text('hello world', 0, 0, 1)
|
58 | 64 | display.text('this is the', 0, 8, 1)
|
59 | 65 | display.text('CircuitPython', 0, 16, 1)
|
60 |
| -display.text('adafruit lib', 0, 24, 1) |
| 66 | +display.text('adafruit lib-', 0, 24, 1) |
61 | 67 | display.text('rary for the', 0, 32, 1)
|
62 | 68 | display.text('PCD8544! :) ', 0, 40, 1)
|
63 | 69 |
|
|
0 commit comments