oled 小程序 舵机

曹え 5811 发布于:2024-04-08 02:21:41

from machine import Pin, SoftI2C
import time
import framebuf
import face.face as F
import face.facelib as S
import oled.oled as O
import random
#import lib.sg90 as sg
#p1 = Pin(20,Pin.OUT)
#dj = sg.SERVO(p1)




fb = []
fb.append(S.init(F.face1))
fb.append(S.init(F.face1a))
fb.append(S.init(F.face2))
fb.append(S.init(F.face3))
fb.append(S.init(F.face4))
fb.append(S.init(F.face5))

while True:
    a = random.randint(0,5)
    b = random.randint(2,8) * 100
    S.show(fb[a],b)
    S.show(fb[2],200)
    S.show(fb[a],b)
    dj.servo_writefx(45)
    time.sleep(5)
    dj.servo_writefx(180)
#chinese('星期四',0,30) 
# 在指定位置处显示文字
#oled.text('Hello!', 0, 0)
#oled.show()


觉得有用请点个赞吧!
0 23