我用颜色识别控制小车的例子,使用PWM波控制小车,范围1000us到2000us。调节P变大,但不能保证h_output ± x_output范围在1000~2000之间,该怎么办呢
写一个if else就行了吧。
if a> 2000: a = 2000 if a< 1000: a = 1000