'''
example name：OLED Display(I2C BUS)
version：v1.0
date：2020.3
Author：01Studio
Forum: forum.01studio.org
Reference link: https://luma-oled.readthedocs.io/en/latest/python-usage.html
'''

# import luma module
from luma.core.render import canvas
from luma.oled.device import ssd1306

#initialize oled，I2C1; the oled I2C address is 0x3c
device = ssd1306(port=1, address=0x3C)

#Display string; "with...as..."Can handle exceptions automatically
with canvas(device) as draw:
    draw.text((0, 0),  'Hello World!', fill="white")
    draw.text((0, 20), 'Raspberry Pi', fill="white")
    draw.text((0, 50), 'By 01Studio', fill="white")