Controlling Herkulex DRS-0101

OpenMV related project discussion.
Marwaladeen
Posts: 1
Joined: Mon Feb 04, 2019 11:01 am

Controlling Herkulex DRS-0101

Postby Marwaladeen » Mon Feb 04, 2019 11:15 am

Hi there,

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 ?

Thanks

Code: Select all


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()

User avatar
kwagyeman
Posts: 3048
Joined: Sun May 24, 2015 2:10 pm

Re: Controlling Herkulex DRS-0101

Postby kwagyeman » Mon Feb 04, 2019 11:29 am

Hi, the OpenMV Cam UART needs to be UART(3).
Nyamekye,

Return to “Project Discussion”

Who is online

Users browsing this forum: No registered users and 4 guests