import math
import framebuf
from machine import Pin, SoftI2C
import ssd1306
i2c = SoftI2C(scl=Pin(22), sda=Pin(21))
oled = ssd1306.SSD1306_I2C(128, 64, i2c)
# Use the built-in framebuf object directly
fb = oled.framebuf
# Clear
fb.fill(0)
# Left eye - solid rectangle
fb.fill_rect(8, 4, 42, 30, 1)
# Right eye - solid rectangle
fb.fill_rect(76, 4, 42, 30, 1)
# Loop every x pixel from left to right
for x in range(40, 89):
# calculate y for this exact x
y = int(48 - 8 * math.sqrt(1 - ((x - 64) / 24) ** 2))
fb.pixel(x, y, 1)
fb.pixel(x, y + 1, 1)
# Push to screen
oled.show()Loading
esp32-devkit-c-v4
esp32-devkit-c-v4
Loading
ssd1306
ssd1306