![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Ngetes
main.cpp@2:f07401343541, 2018-09-11 (annotated)
- Committer:
- hisyamfs
- Date:
- Tue Sep 11 13:26:30 2018 +0000
- Revision:
- 2:f07401343541
- Parent:
- 1:2759fc78aa04
asf;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hisyamfs | 0:23b97841e8dc | 1 | #include "mbed.h" |
hisyamfs | 0:23b97841e8dc | 2 | #include "AX12.h" |
hisyamfs | 0:23b97841e8dc | 3 | |
hisyamfs | 0:23b97841e8dc | 4 | Serial pc(USBTX, USBRX); |
hisyamfs | 0:23b97841e8dc | 5 | int deg1 = 0; |
hisyamfs | 0:23b97841e8dc | 6 | int deg2 = deg1+10; |
hisyamfs | 0:23b97841e8dc | 7 | int id1 = 6; |
hisyamfs | 0:23b97841e8dc | 8 | int id2 = 11; |
hisyamfs | 2:f07401343541 | 9 | int kosong1, kosong2; |
hisyamfs | 0:23b97841e8dc | 10 | |
hisyamfs | 0:23b97841e8dc | 11 | int main() |
hisyamfs | 0:23b97841e8dc | 12 | { |
hisyamfs | 2:f07401343541 | 13 | AX12 servo1(PC_6, PC_7, PC_8, id1, 1000000); // tx, rx, tx_enable, servo ID, baud rate |
hisyamfs | 0:23b97841e8dc | 14 | while (1) |
hisyamfs | 2:f07401343541 | 15 | { |
hisyamfs | 2:f07401343541 | 16 | servo1.SetGoal(240); |
hisyamfs | 2:f07401343541 | 17 | pc.printf("test"); |
hisyamfs | 2:f07401343541 | 18 | wait(0.5); |
hisyamfs | 2:f07401343541 | 19 | servo1.SetGoal(150); |
hisyamfs | 2:f07401343541 | 20 | wait(0.5); |
hisyamfs | 0:23b97841e8dc | 21 | } |
hisyamfs | 0:23b97841e8dc | 22 | } |