Skip to content

Commit

Permalink
Merge pull request #18 from kattni/readme-update
Browse files Browse the repository at this point in the history
Update usage example in README
  • Loading branch information
caternuson committed Apr 29, 2019
2 parents def87f0 + 2eb545c commit efdd7d3
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,31 +40,35 @@ Usage Example
# create the spi device and pins we will need
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
ecs = digitalio.DigitalInOut(board.D10)
dc = digitalio.DigitalInOut(board.D9)
srcs = digitalio.DigitalInOut(board.D8)
rst = digitalio.DigitalInOut(board.D7)
busy = digitalio.DigitalInOut(board.D6)
ecs = digitalio.DigitalInOut(board.D12)
dc = digitalio.DigitalInOut(board.D11)
srcs = digitalio.DigitalInOut(board.D10) # can be None to use internal memory
rst = digitalio.DigitalInOut(board.D9) # can be None to not use this pin
busy = digitalio.DigitalInOut(board.D5) # can be None to not use this pin
# 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
display.clear_buffer()
print("Clear buffer")
display.fill(Adafruit_EPD.WHITE)
display.pixel(10, 100, Adafruit_EPD.BLACK)
r_width = 5
r_pos = display.height
print("Draw Rectangles")
display.fill_rect(5, 5, 10, 10, Adafruit_EPD.RED)
display.rect(0, 0, 20, 30, Adafruit_EPD.BLACK)
#draw some rectangles!
color = Adafruit_EPD.BLACK
while r_pos > display.height/2:
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 lines")
display.line(0, 0, display.width-1, display.height-1, Adafruit_EPD.BLACK)
display.line(0, display.height-1, display.width-1, 0, Adafruit_EPD.RED)
print("Draw text")
display.text('hello world', 25, 10, Adafruit_EPD.BLACK)
display.display()
Expand Down

0 comments on commit efdd7d3

Please sign in to comment.