from ssd1306_setup import WIDTH, HEIGHT, setup
from writer import Writer
import myfont # Font to use
from time import sleep
use_spi=False # Tested with a 128*64 I2C connected SSD1306 display
ssd = setup(use_spi) # Instantiate display: must inherit from framebuf
# Demo drawing geometric shapes
rhs = WIDTH -1
ssd.line(rhs - 20, 0, rhs, 20, 1) # Demo underlying framebuf methods
square_side = 10
ssd.fill_rect(rhs - square_side, 0, square_side, square_side, 1)
# Instantiate a writer for a specific font
wri = Writer(ssd, myfont) # verbose = False to suppress console output
Writer.set_textpos(ssd, 0, 0) # In case a previous test has altered this
#wri.printstring('Sunday\n12 Aug 2018\n10.30am')
ssd.show()
i=90
sleep(1)
while True:
i=i+1
print("--- New iteration: ---")
Writer.set_textpos(ssd, 0, 0)
wri.printstring(f"{str(i):>5}°")
ssd.show()
sleep(2)