将i2c smartdrive传感器与Pio Cli命令一起使用以运行电动机 [英] Using the i2c smartdrive sensor with a Pio Cli commands to run motors

查看:102
本文介绍了将i2c smartdrive传感器与Pio Cli命令一起使用以运行电动机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的i2c传感器: http://www .mindsensors.com/rpi/76-smartdrive-high-current-motor-controller 请在文档"会议中以pdf格式查看

基于此Google指南 https://developer.android. com/things/sdk/pio/pio-cli.html 为了在确定的速度,方向,持续时间等条件下运行电动机,我需要输入XX ZZ YY UU.

例如:pio i2c I2C1 0x1B写寄存器缓冲区0xXX 0xYY 0xUU 0xZZ

在这种情况下,我将在我的android Things应用程序上使用writeRegBuffer()在确定的加速,方向,持续时间等条件下运行一台,两台或两台电机?

例如:我(通过jcenter)在intel edison/android事物DP2中使用了该驱动程序,但是现在我想创建一个AT驱动程序以在nx pico和rpi 3中使用smartdrive,因为不会再有mraa了:

https://github.com/androidthings/contrib-drivers/issues/70

我的问题是 :如果您在此处看到: https://github .com/intel-iot-devkit/upm/blob/master/src/smartdrive/smartdrive.cxx

SmartDrive::Run_Seconds(int motor_id, int direction, uint8_t speed, uint8_t duration, bool wait_for_completion, int next_action )

您将看到writeArray(array, sizeof(array));

好.我需要帮助才能在使用writeRegBuffer(int reg, byte[] buffer, int length)write(byte[] buffer, int length)

的android事物中使用它

解决方案

在方向A上运行电动机1 pio i2c I2C1 0x1B原始写入0x46 128 0x05 0x00 0xD1

使电机1沿B方向运行 pio i2c I2C1 0x1B原始写入0x46 127 0x05 0x00 0xD1

使电动机2沿A方向运行 pio i2c I2C1 0x1B原始0x4E 128 0x05 0x00 0xD1

使电动机2沿B方向运行 pio i2c I2C1 0x1B写原始0x4E 127 0x05 0x00 0xD1

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://developer.android.com/things/sdk/pio/pio-cli.html What I need to put in XX ZZ YY UU to run motors in determined speed, direction, duration, etc...

e.g.: pio i2c I2C1 0x1B write-reg-buffer 0xXX 0xYY 0xUU 0xZZ

As (in this case) I will use writeRegBuffer() on my android things app to run one, two or both motors in determined spped, direction, duration, etc?

e.g.: I used (via jcenter) this driver in intel edison/android things DP2, but now I want to create an AT driver to use smartdrive in nx pico and rpi 3, because there would be no more mraa:

https://github.com/androidthings/contrib-drivers/issues/70

My questions is: If you see here: https://github.com/intel-iot-devkit/upm/blob/master/src/smartdrive/smartdrive.hpp and especially in this: https://github.com/intel-iot-devkit/upm/blob/master/src/smartdrive/smartdrive.cxx in function

SmartDrive::Run_Seconds(int motor_id, int direction, uint8_t speed, uint8_t duration, bool wait_for_completion, int next_action )

you will see writeArray(array, sizeof(array));

ok. I need help to use this in android things using writeRegBuffer(int reg, byte[] buffer, int length) and write(byte[] buffer, int length)

解决方案

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

这篇关于将i2c smartdrive传感器与Pio Cli命令一起使用以运行电动机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆