Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Zebrafish007 opened this issue Dec 2, 2019 · 0 comments
Open

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

Zebrafish007 opened this issue Dec 2, 2019 · 0 comments

Comments

@Zebrafish007
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant