ghi-electronics / micropython

A MicroPython port to GHI Electronics SITCore SC13xxx line of products.
https://micropython.org
MIT License
0 stars 0 forks source link

Add buildin ssd1306 #6

Open Palomino34 opened 3 years ago

Palomino34 commented 3 years ago

Added: Note: PB2, PB8, PB9 can be different, depend on rev.

from machine import Pin,I2C, SoftI2C
import ssd1306

pen=Pin("PB2",Pin.OUT_PP)
pen.high()

pscl = Pin("PB8", Pin.OPEN_DRAIN)
psda = Pin("PB9", Pin.OPEN_DRAIN)
i2c = SoftI2C(pscl, psda, freq=100000)
ssd = ssd1306.SSD1306_I2C(128, 64, i2c)
ssd.text('GHI Electronics', 0, 0, 1)
ssd.text('BrainPad Pulse', 0, 15, 1)
ssd.text('  SC13048Q', 0, 30, 1)
ssd.text(' Micropython', 0, 45, 1)
ssd.fill_rect(10, 60, 20, 3, 1)
ssd.show()