Update usage example in README
This commit is contained in:
parent
906c11d134
commit
2eb545c119
1 changed files with 22 additions and 18 deletions
40
README.rst
40
README.rst
|
|
@ -40,31 +40,35 @@ Usage Example
|
||||||
|
|
||||||
# create the spi device and pins we will need
|
# create the spi device and pins we will need
|
||||||
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
|
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
|
||||||
ecs = digitalio.DigitalInOut(board.D10)
|
ecs = digitalio.DigitalInOut(board.D12)
|
||||||
dc = digitalio.DigitalInOut(board.D9)
|
dc = digitalio.DigitalInOut(board.D11)
|
||||||
srcs = digitalio.DigitalInOut(board.D8)
|
srcs = digitalio.DigitalInOut(board.D10) # can be None to use internal memory
|
||||||
rst = digitalio.DigitalInOut(board.D7)
|
rst = digitalio.DigitalInOut(board.D9) # can be None to not use this pin
|
||||||
busy = digitalio.DigitalInOut(board.D6)
|
busy = digitalio.DigitalInOut(board.D5) # can be None to not use this pin
|
||||||
|
|
||||||
# give them all to our driver
|
# give them all to our driver
|
||||||
display = Adafruit_IL0373(152, 152, rst, dc, busy, srcs, ecs, spi)
|
print("Creating display")
|
||||||
|
display = Adafruit_IL0373(104, 212, spi, # 2.13" Tri-color display
|
||||||
|
cs_pin=ecs, dc_pin=dc, sramcs_pin=srcs,
|
||||||
|
rst_pin=rst, busy_pin=busy)
|
||||||
|
|
||||||
|
display.rotation = 1
|
||||||
|
|
||||||
# clear the buffer
|
# clear the buffer
|
||||||
display.clear_buffer()
|
print("Clear buffer")
|
||||||
|
display.fill(Adafruit_EPD.WHITE)
|
||||||
|
display.pixel(10, 100, Adafruit_EPD.BLACK)
|
||||||
|
|
||||||
r_width = 5
|
print("Draw Rectangles")
|
||||||
r_pos = display.height
|
display.fill_rect(5, 5, 10, 10, Adafruit_EPD.RED)
|
||||||
|
display.rect(0, 0, 20, 30, Adafruit_EPD.BLACK)
|
||||||
|
|
||||||
#draw some rectangles!
|
print("Draw lines")
|
||||||
color = Adafruit_EPD.BLACK
|
display.line(0, 0, display.width-1, display.height-1, Adafruit_EPD.BLACK)
|
||||||
while r_pos > display.height/2:
|
display.line(0, display.height-1, display.width-1, 0, Adafruit_EPD.RED)
|
||||||
if r_pos < display.height - 50:
|
|
||||||
color = Adafruit_EPD.RED
|
|
||||||
display.rect(display.width - r_pos, display.height - r_pos,
|
|
||||||
display.width - 2*(display.width - r_pos),
|
|
||||||
display.height - 2*(display.height - r_pos), color)
|
|
||||||
r_pos = r_pos - r_width
|
|
||||||
|
|
||||||
|
print("Draw text")
|
||||||
|
display.text('hello world', 25, 10, Adafruit_EPD.BLACK)
|
||||||
display.display()
|
display.display()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue