LCD和三个舵机能同时使用吗?一边让舵机动一边看LCD
-
舵机控制例子
这个例子展示了如何使用OpenMV来控制舵机
import sensor, image, time
from pyb import Servo
import lcd
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)
lcd.init()
s1 = Servo(1) # P7s3 = Servo(3) # P9
lcd.init()
clock = time.clock()
while(True):
img=sensor.snapshot()
lcd.display(sensor.snapshot())
for i in range(1000):
img=sensor.snapshot()
s1.pulse_width(1000 + i)s3.pulse_width(1000 + i) time.sleep_ms(10) for i in range(1000): img=sensor.snapshot() s1.pulse_width(1999 - i) s3.pulse_width(1999 - i) time.sleep_ms(10)
-