Still Test

Dependencies:   DXL_SDK_For_F446RE RobotControl_7Axis Matrix mbed

Committer:
stanley1228
Date:
Tue Feb 07 04:12:41 2017 +0000
Revision:
0:1780ffc33286
Child:
2:fb9508744bc4
can use to change led

Who changed what in which revision?

UserRevisionLine numberNew contents of line
stanley1228 0:1780ffc33286 1 #include "mbed.h"
stanley1228 0:1780ffc33286 2 #include "dynamixel.h"
stanley1228 0:1780ffc33286 3
stanley1228 0:1780ffc33286 4 #define ADDRESS_LED 0x19
stanley1228 0:1780ffc33286 5
stanley1228 0:1780ffc33286 6
stanley1228 0:1780ffc33286 7 DigitalOut myled(LED1);
stanley1228 0:1780ffc33286 8 Serial pc(SERIAL_TX, SERIAL_RX);
stanley1228 0:1780ffc33286 9
stanley1228 0:1780ffc33286 10
stanley1228 0:1780ffc33286 11 int main()
stanley1228 0:1780ffc33286 12 {
stanley1228 0:1780ffc33286 13 int rt =0;
stanley1228 0:1780ffc33286 14
stanley1228 0:1780ffc33286 15 pc.printf("start\n",rt);
stanley1228 0:1780ffc33286 16
stanley1228 0:1780ffc33286 17 rt=dxl_initialize( 1, 1);
stanley1228 0:1780ffc33286 18 pc.printf("dxl_initialize rt=%d\n",rt);
stanley1228 0:1780ffc33286 19
stanley1228 0:1780ffc33286 20 myled = 0; // LED is ON
stanley1228 0:1780ffc33286 21
stanley1228 0:1780ffc33286 22 /**************************
stanley1228 0:1780ffc33286 23 *** Check communication ***
stanley1228 0:1780ffc33286 24 **************************/
stanley1228 0:1780ffc33286 25
stanley1228 0:1780ffc33286 26 pc.printf("before=%d\n",rt);
stanley1228 0:1780ffc33286 27 dxl_write_byte(3,ADDRESS_LED,0);
stanley1228 0:1780ffc33286 28 //dxl_ping(3);
stanley1228 0:1780ffc33286 29
stanley1228 0:1780ffc33286 30 pc.printf("after=%d\n",rt);
stanley1228 0:1780ffc33286 31 while(1)
stanley1228 0:1780ffc33286 32 {
stanley1228 0:1780ffc33286 33 dxl_write_byte(3,ADDRESS_LED,1);
stanley1228 0:1780ffc33286 34 //myled = 1; // LED is ON
stanley1228 0:1780ffc33286 35 wait(2);
stanley1228 0:1780ffc33286 36 dxl_write_byte(3,ADDRESS_LED,0);
stanley1228 0:1780ffc33286 37 //myled = 0; // LED is ON
stanley1228 0:1780ffc33286 38 wait(2);
stanley1228 0:1780ffc33286 39 }
stanley1228 0:1780ffc33286 40 }