hisyam fs
/
Test_servo
Ngetes
Diff: main.cpp
- Revision:
- 0:23b97841e8dc
- Child:
- 1:2759fc78aa04
diff -r 000000000000 -r 23b97841e8dc main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Aug 29 09:45:32 2018 +0000 @@ -0,0 +1,45 @@ +#include "mbed.h" +#include "AX12.h" + +int kosong1, kosong2; +Serial pc(USBTX, USBRX); +int deg1 = 0; +int deg2 = deg1+10; +int id1 = 6; +int id2 = 11; + +int main() +{ + AX12 servo1(PC_6, PC_7, PC_8, id1, 1000000); // tx, rx, tx_enable, servo ID, baud rate + AX12 servo2(PC_6, PC_7, PC_8, id2, 1000000); + while (1) + { + for (int i = 1; i <= 30; i += 1) + { + deg1 = i*10; + deg2 = (deg1+10) % 300; + servo1.SetGoal(deg1); + servo2.SetGoal(deg2); +// servo1.MultSetGoal( deg1, 1, +// deg1, 1, +// deg1, 1, +// deg1, 1, +// deg1, 1, +// deg1, 1, +// deg1, 1, +// deg1, 1, +// deg1, 1, +// deg1, 1, +// deg1, 1, +// deg1, 1, +// deg1, 1, +// deg1, 1, +// deg1, 1, +// deg1, 1, +// deg1, 1, +// deg1, 1); + pc.printf("1: %d %d 2: %d %d\n", id1, deg1, id2, deg2); + wait(3); + } + } +} \ No newline at end of file