-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo_flip.py
34 lines (25 loc) · 844 Bytes
/
demo_flip.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""SSD1306 demo (flip)."""
from time import sleep
from machine import Pin, I2C # type: ignore
from xglcd_font import XglcdFont
from ssd1306 import Display
def test():
"""Test code."""
i2c = I2C(1, freq=400000, scl=Pin(40), sda=Pin(41)) # Qt-Py S2 I2C bus 1
display = Display(i2c=i2c, flip=True) # Flip 180 degrees
print("Loading font. Please wait.")
bitstream = XglcdFont('fonts/Bitstream_Vera35x32.c', 35, 32)
display.draw_bitmap("images/no_wifi32x32.mono", 0, 0, 32, 32, invert=True)
display.draw_text(45, 0, "WiFi", bitstream)
display.present()
sleep(3)
display.flip(False) # No flip which is the default
display.present()
sleep(3)
display.flip() # Flip 180 degrees
display.present()
sleep(10)
display.flip(False)
display.cleanup()
print('Done.')
test()