from machine import Pin, I2C
from ssd1306 import SSD1306_I2C
import math
i2c_oled = I2C(scl=Pin(25), sda=Pin(26))
oled_w = 128
oled_h = 64
oled = SSD1306_I2C(oled_w, oled_h, i2c_oled)
oled.fill(0)
x0, y0 = 64, 32
r = 10
thickness = 5
for x in range(128):
for y in range(64):
d = math.sqrt((x - x0) ** 2 + (y - y0) ** 2)
if math.isclose(d, r, rel_tol=0.01, abs_tol=0.01):
oled.pixel(x, y, 1)
elif r - thickness <= d <= r:
if abs(math.sqrt((x-x0) ** 2 + (y-y0) ** 2) - r) <= thickness / 2:
oled.pixel(x, y, 1)
oled.show()