Skip to content

Missing example code for TMCM (e.g. 1270) CANopen #13

@Zebrafish007

Description

@Zebrafish007

Hi,

I am struggling to get my ESD CAN-USB/2 device working with the python-tmcm software. What do I need to write for "serial_port = Serial("/dev/tty.usbmodem1241")" for below code as I have an usb/can interface device.

Cheers,

Installed:
Win 10 Pro, x64
python 3.7.4
pyUSB 1.0.2
LibUSB1 1.7.1
CAN 3.3.2


from serial import Serial
from time import sleep
import TMCL

serial-address as set on the TMCM module.

MODULE_ADDRESS = 1

Open the serial port presented by your rs485 adapter

serial_port = Serial("/dev/tty.usbmodem1241")

Create a Bus instance using the open serial port

bus = TMCL.connect(serial_port)

Get the motor

motor = bus.get_motor(MODULE_ADDRESS)

From this point you can start issuing TMCL commands

to the motor as per the TMCL docs. This example will

rotate the motor left at a speed of 1234 for 2 seconds

motor.rotate_left(1234)
sleep(2)
motor.stop()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions