串口与舵机拓展版的i2c问题
-
import time from pyb import UART 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) uart = UART(3, 19200, timeout_char=1000) while True: uart.write("哈哈哈") servo.position(0, 0) time.sleep(2000) servo.position(0, 180) time.sleep(2000) servo.position(1, 0) time.sleep(2000) servo.position(1, 160) time.sleep(2000)
舵机拓展版的i2c接口是P4和P5,但是我想用舵机拓展版的同时使用串口发送命令,我加进去串口的函数时就报错,请问该怎么办
-
舵机扩展板使用P4P5引脚,UART3会冲突。
解决办法:换用UART1