Ngetes

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
hisyamfs
Date:
Tue Sep 11 13:26:30 2018 +0000
Parent:
1:2759fc78aa04
Commit message:
asf;

Changed in this revision

AX12/AX12.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/AX12/AX12.cpp	Fri Aug 31 10:45:30 2018 +0000
+++ b/AX12/AX12.cpp	Tue Sep 11 13:26:30 2018 +0000
@@ -24,8 +24,9 @@
 #include "AX12.h"
 #include "mbed.h"
 
-AX12::AX12 (PinName tx, PinName rx, PinName tx_ena, int ID, int baud) : _ax12(tx,rx), _ena_tx(tx_ena, 1)
+AX12::AX12 (PinName tx, PinName rx, PinName tx_ena, int ID, int baud) : _ax12(tx,rx), _ena_tx(tx_ena)
 {
+    _ena_tx = 1;
     _ax12.baud(baud);
     _baud_bit = 1000000/baud;
     _wait_sent = 20 * _baud_bit;
--- a/main.cpp	Fri Aug 31 10:45:30 2018 +0000
+++ b/main.cpp	Tue Sep 11 13:26:30 2018 +0000
@@ -1,22 +1,22 @@
 #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 kosong1, kosong2;
 
 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);
-    
+    AX12 servo1(PC_6, PC_7, PC_8, id1, 1000000); // tx, rx, tx_enable, servo ID, baud rate    
     while (1) 
-    {        
-       servo1.SetTorqueEnable(0);
-       pc.printf("TEst \n");
-       wait(0.5);
+    {    
+        servo1.SetGoal(240);
+        pc.printf("test");
+        wait(0.5);
+        servo1.SetGoal(150);
+        wait(0.5);
     }    
 }
\ No newline at end of file