I have got a school project using the OpenMV Cam M7, I would like to control a smart servomotor, the DRS-0101.
In order to do it, I must send data to the servo throught UART.
Here is an example : 0xFF 0xFF 0x0B 0x01 0x03 0xC6 0x38 (7 bytes to send one after an other).
Here is the communication protocol : Data Bit : 8, Stop Bit : 1, Parity : None, Flow Control : None, Baud Rate : 57 600.
I have made a script but it does not seem to be working Any idea ?
import sensor, image, time from pyb import UART sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) sensor.skip_frames(time = 2000) clock = time.clock() servo = UART(1, 57600, timeout_char=1000) servo.init(57600, bits=8, parity=None, stop=1,timeout_char=100) data = [0xFF,0xFF,0x0C,0x01,0x06,0xEC,0x12,0x02,0xF4,0x01,0x10,0x01] for i in range(len(data)): servo.writechar(data[i]) while(True): clock.tick() img = sensor.snapshot()