Using The I2c Smartdrive Sensor With A Pio Cli Commands To Run Motors
This is my i2c sensor: http://www.mindsensors.com/rpi/76-smartdrive-high-current-motor-controller look in pdf in Documents sessions please Based on this google guide https://devel
Solution 1:
Per the PIO CLI tool doc you linked, the format of the i2c
command is:
$ pio i2c <bus_name><slave_address><command><reg><val>
Your motor controller has a default slave address of 0x36 and uses registers. As an example you could write to the "Motor 1 Speed" register (address 0x46) using this tool like so:
$ pio i2c I2C1 0x36write-reg-byte0x46 <speed_value>
The same operation from code would look like the following:
PeripheralManagerServicemanager=newPeripheralManagerService();
I2cDevicedevice= manager.openI2cDevice("I2C1", 0x36);
device.writeRegByte(0x46, speed);
Solution 2:
run motor 1 in direction A pio i2c I2C1 0x1B write-raw 0x46 128 0x05 0x00 0xD1
run motor 1 in direction B pio i2c I2C1 0x1B write-raw 0x46 127 0x05 0x00 0xD1
run motor 2 in direction A pio i2c I2C1 0x1B write-raw 0x4E 128 0x05 0x00 0xD1
run motor 2 in direction B pio i2c I2C1 0x1B write-raw 0x4E 127 0x05 0x00 0xD1
Post a Comment for "Using The I2c Smartdrive Sensor With A Pio Cli Commands To Run Motors"