from ssd1306 import SSD1306_I2C
from machine import Pin, I2C
import time
import math
# equation of the circle
# x=rcos0+c
# y=rsin0+c
# deg to radian conversion
# rad=(deg/360)*2pi
i2c=I2C(1,sda=Pin(2),scl=Pin(3),freq=400000)
display=SSD1306_I2C(128,64,i2c)
msg="hello!"
display.text(msg,0,0)
xCebter=64
yCenter=32
r=20
phase=0
while True:
for deg in range(0,360,1):
rads=deg*2*3.1415/360
x=r*math.cos(1*rads+phase)+xCebter
y=0.5*r*math.sin(5*rads)+yCenter
display.pixel(int(x),int(y),1)
display.show()
display.fill(0)
phase=phase+1*2*3.1414/360