is there a libaray for the jrk to use with a raspberry pi with i2c bus?
i only need set.target and get.feedback
is there a libaray for the jrk to use with a raspberry pi with i2c bus?
i only need set.target and get.feedback
Hello.
No; we do not have a Python module for the Jrk G2 controller for the Raspberry Pi. If you do not have a particular reason for using I2C to communicate with the Jrk G2 from your Raspberry Pi, you might consider using jrk2cmd, a command-line utility that controls the Jrk G2 via its native USB interface. You can find more details in the Jrk G2 Motor Controller User’s Guide, particularly the “Setting up USB control” section.
- Amanda
Hello.
We have developed some example Python code for talking to the Jrk over I²C under Linux. You can find it in “Example I²C code for Linux in Python” section in the Jrk G2 user’s guide. It shows how to set the target and get the feedback.
–David
Ok! Thank you!
I am using a asus tinkerboard with i2c. following code with python3 an smbus runs for me very well…
from tkinter import *
import smbus
bus = smbus.SMBus(1) # 0 = /dev/i2c-0 (port I2C0), 1 = /dev/i2c-1 (port I2C1)
addr = 0x0b #7 bit address (will be left shifted to add the read write bit)
cmd = 0xC0
target = 322
def set_target(target):
i2cBytes1 = cmd+(target & 0x1F)
i2cBytes2 = (target >> 5) & 0x7F
bus.write_byte_data(addr, i2cBytes1 , i2cBytes2)
def get_feedback():
cmd=0xA7
b = bus.read_i2c_block_data(addr, cmd)
return b[0] + 256 * b[1]
def motorstop():
bus.write_byte_data(addr, 0xFF, 0x80)