logo

舵机驱动,运行代码显示I2C弃用,咋改。

2023-04-17 19:58
W
i4s5
import time
from servo import Servos
from machine import I2C, Pin

i2c = I2C(sda=Pin('P5'), scl=Pin('P4'))
servo = Servos(i2c, address=0x40, freq=50, min_us=500, max_us=2500, degrees=180)

while True:

    servo.position(0, 180)
    time.sleep_ms(1000)

    servo.position(0, 180)
    time.sleep_ms(1000)
2023-04-18 18:18
I
网红小智智 星瞳科技

只是warning,不影响使用。