|
from machine import Pin, SoftI2C
import ssd1306py as lcd
import math
import gfx
oled_width = 128
oled_height = 64
# ESP8266 Pin assignment
i2c = SoftI2C(scl=Pin(7), sda=Pin(6)) # Adjust the Pin numbers based on your connections
lcd.init_i2c(7,6,oled_width,oled_height)
graphics = gfx.GFX(oled_width, oled_height, lcd.pixel)
graphics.rect(10, 10, 50, 30, 1)
lcd.show()
graphics.circle(64, 32, 10, 1)
lcd.show()
lcd.text('digikey (`3`)y ', 0, 0, 8)
font16 = {
0xe4bda0:
[0x08, 0x08, 0x08, 0x11, 0x11, 0x32, 0x34, 0x50, 0x91, 0x11, 0x12, 0x12, 0x14, 0x10, 0x10, 0x10, 0x80, 0x80,
0x80, 0xFE, 0x02, 0x04, 0x20, 0x20, 0x28, 0x24, 0x24, 0x22, 0x22, 0x20, 0xA0, 0x40], # 你
0xe5a5bd:
[0x10, 0x10, 0x10, 0x10, 0xFC, 0x24, 0x24, 0x25, 0x24, 0x48, 0x28, 0x10, 0x28, 0x44, 0x84, 0x00, 0x00, 0xFC,
0x04, 0x08, 0x10, 0x20, 0x20, 0xFE, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xA0, 0x40] # 好
}
lcd.show()
lcd.set_font(font16, 16)
lcd.text_cn("你好", 0, 40, 16)
lcd.show() # Show the text