Skip to content

Commit efdd7d3

Browse files
authored
Merge pull request #18 from kattni/readme-update
Update usage example in README
2 parents def87f0 + 2eb545c commit efdd7d3

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

README.rst

+22-18
Original file line numberDiff line numberDiff line change
@@ -40,31 +40,35 @@ Usage Example
4040
4141
# create the spi device and pins we will need
4242
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
43-
ecs = digitalio.DigitalInOut(board.D10)
44-
dc = digitalio.DigitalInOut(board.D9)
45-
srcs = digitalio.DigitalInOut(board.D8)
46-
rst = digitalio.DigitalInOut(board.D7)
47-
busy = digitalio.DigitalInOut(board.D6)
43+
ecs = digitalio.DigitalInOut(board.D12)
44+
dc = digitalio.DigitalInOut(board.D11)
45+
srcs = digitalio.DigitalInOut(board.D10) # can be None to use internal memory
46+
rst = digitalio.DigitalInOut(board.D9) # can be None to not use this pin
47+
busy = digitalio.DigitalInOut(board.D5) # can be None to not use this pin
4848
4949
# give them all to our driver
50-
display = Adafruit_IL0373(152, 152, rst, dc, busy, srcs, ecs, spi)
50+
print("Creating display")
51+
display = Adafruit_IL0373(104, 212, spi, # 2.13" Tri-color display
52+
cs_pin=ecs, dc_pin=dc, sramcs_pin=srcs,
53+
rst_pin=rst, busy_pin=busy)
54+
55+
display.rotation = 1
5156
5257
# clear the buffer
53-
display.clear_buffer()
58+
print("Clear buffer")
59+
display.fill(Adafruit_EPD.WHITE)
60+
display.pixel(10, 100, Adafruit_EPD.BLACK)
5461
55-
r_width = 5
56-
r_pos = display.height
62+
print("Draw Rectangles")
63+
display.fill_rect(5, 5, 10, 10, Adafruit_EPD.RED)
64+
display.rect(0, 0, 20, 30, Adafruit_EPD.BLACK)
5765
58-
#draw some rectangles!
59-
color = Adafruit_EPD.BLACK
60-
while r_pos > display.height/2:
61-
if r_pos < display.height - 50:
62-
color = Adafruit_EPD.RED
63-
display.rect(display.width - r_pos, display.height - r_pos,
64-
display.width - 2*(display.width - r_pos),
65-
display.height - 2*(display.height - r_pos), color)
66-
r_pos = r_pos - r_width
66+
print("Draw lines")
67+
display.line(0, 0, display.width-1, display.height-1, Adafruit_EPD.BLACK)
68+
display.line(0, display.height-1, display.width-1, 0, Adafruit_EPD.RED)
6769
70+
print("Draw text")
71+
display.text('hello world', 25, 10, Adafruit_EPD.BLACK)
6872
display.display()
6973
7074

0 commit comments

Comments
 (0)