The intent of this project is to use and learn, inverse kinematics, pid control of position, touch control using smartgpu_v1 board for viewing data or debug messages while moving a 4 DOF robotic arm.
Dependencies: AX12 InversKinem PIDPositionController SMARTGPU SerialHalfDuplex mbed
http://mbed.org/users/aimen/notebook/4dofroboticarmax12_lpc1768-with-smartgpu/
main.cpp
- Committer:
- aimen
- Date:
- 2014-04-01
- Revision:
- 2:de8b38a39938
- Parent:
- 0:91d276232027
- Child:
- 3:41b605f9cdd5
File content as of revision 2:de8b38a39938:
#include "mbed.h" #include "AX12.h" #include "SMARTGPU.h" SMARTGPU lcd(p28,p27,p26); //(TX,RX,Reset); DigitalOut myled1(LED1); DigitalOut myled2(LED2); DigitalOut myled3(LED3); DigitalOut myled4(LED4); AX12 myax12_1(p9,p10,1); //(TX,RX, ID of servo); AX12 myax12_2(p9,p10,2); //(TX,RX, ID of servo); AX12 myax12_3(p9,p10,3); //(TX,RX, ID of servo); AX12 myax12_4(p9,p10,4); //(TX,RX, ID of servo); AX12 myax12_5(p9,p10,5); //(TX,RX, ID of servo); int main() { lcd.reset(); //physically reset SMARTGPU lcd.start(); //initialize the SMARTGPU processor lcd.baudChange(1000000); //set high baud for fast drawing while(1) { myled1 = 1; lcd.string(10,10,300,220,YELLOW,FONT3,TRANS,"Before set goal 150"); //write a string on the screen myax12_1.SetGoal(150); // go to 150 degrees myax12_2.SetGoal(150); // go to 150 degrees myax12_3.SetGoal(150); // go to 150 degrees myax12_4.SetGoal(150); // go to 150 degrees myax12_5.SetGoal(290); // go to 150 degrees lcd.string(10,70,300,220,YELLOW,FONT3,TRANS,"after goal 150"); //write a string on the screen wait_ms(1000); lcd.erase(); myled1 = 0; myled4 = 1; lcd.string(10,10,300,220,YELLOW,FONT3,TRANS,"Before set goal fold up"); //write a string on the screen //myax12_1.SetGoal(300); // go to 150 degrees myax12_2.SetGoal(225); // go to 150 degrees myax12_3.SetGoal(0); // go to 150 degrees myax12_4.SetGoal(90); // go to 150 degrees myax12_5.SetGoal(250); // go to 150 degrees lcd.string(10,70,300,220,YELLOW,FONT3,TRANS,"after goal fold up"); //write a string on the screen wait_ms(1000); lcd.erase(); myled4 = 0; }//end of main while loop }