from machine import Pin, I2C
from ssd1306 import SSD1306_I2C
from time import sleep_ms
from math import sin
i2c = I2C(0, scl=Pin(32), sda=Pin(33))
oled = SSD1306_I2C(128, 64, i2c)
for n in range(5, 105, 5):
oled.text(f'n={n}', 0, 0)
for x in range(0, n):
xi = int(x * (127 / n))
yi = int(37 - 15 * sin(xi / 10))
xf = int((x + 1) * (127 / n))
yf = int(37 - 15 * sin(xf / 10))
oled.line(xi, yi, xf, yf, 1)
oled.show()
sleep_ms(250)
oled.fill(0)
while True:
sleep_ms(1000)