![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
XBusServoの設定を行うプログラムです。
Diff: main.cpp
- Revision:
- 3:db5a2f683282
- Parent:
- 2:32aba462e4df
- Child:
- 4:bde6d41517d3
diff -r 32aba462e4df -r db5a2f683282 main.cpp --- a/main.cpp Wed Jan 11 10:01:47 2017 +0000 +++ b/main.cpp Wed Jan 11 10:31:43 2017 +0000 @@ -88,15 +88,6 @@ return result; } - int16_t index = 0x1D; - int16_t value = 0x01; - // int16_t Angle = 0x0011; - - result = gXBus.setCommand(kXBusOrder_1_Angle_180,&value); - // result = gXBus.setCommand(kX); - - // result = gXBus.setCommand(kXBusOrder_2_ParamWrite,&index); - return kXBusError_NoError; } @@ -106,6 +97,8 @@ //============================================================= int main() { + XBusError result; + if (init() != kXBusError_NoError) { return -1; Led = 1; @@ -117,5 +110,25 @@ gTimer.attach_us(&XbusIntervalHandler, 1000000 / kMotionInterval); while(1) { + //動作角度を180度幅に拡張 + int16_t value = 0x01; + int16_t angleParam = 0x0011; + result = gXBus.setCommand(kXBusOrder_1_Angle_180,&value); + result = gXBus.setCommand(kXBusOrder_2_ParamWrite,&angleParam); + + //電源が入るとすぐに指示位置に移動 + int16_t quick = 0x00; + int16_t quickParam = 0x0012; + result = gXBus.setCommand(kXBusOrder_1_SlowStart,&quick); + result = gXBus.setCommand(kXBusOrder_2_ParamWrite,&quickParam); + + //信号が途切れたらその位置に固定 + int16_t steer = 0x01; + int16_t steerParam = 0x0013; + result = gXBus.setCommand(kXBusOrder_1_StopMode,&steer); + result = gXBus.setCommand(kXBusOrder_2_ParamWrite,&steerParam); + + wait(0.1); + } }