config AX12
Fork of configure_ax12_test_bras_module by
Diff: AX12.cpp
- Revision:
- 1:fce3323d874f
- Parent:
- 0:c03cffe402df
diff -r c03cffe402df -r fce3323d874f AX12.cpp --- a/AX12.cpp Wed Feb 03 14:01:53 2016 +0000 +++ b/AX12.cpp Fri Nov 25 17:38:14 2016 +0000 @@ -456,6 +456,33 @@ return(0); } +int AX12::Set_Goal_speed(int speed, int flags) +{ + + char reg_flag = 0; + char data[2]; + + // set the flag is only the register bit is set in the flag + if (flags == 0x2) { + reg_flag = 1; + } + + data[0] = speed & 0xff; // bottom 8 bits + data[1] = speed >> 8; // top 8 bits + + // write the packet, return the error code + int rVal = write(_ID, AX12_REG_MOVING_SPEED, 2, data, reg_flag); + + /*if (flags == 1) { + // block until it comes to a halt + while (isMoving()) + { + } + + }*/ + return(rVal); +} + // if flag[0] is set, were blocking // if flag[1] is set, we're registering