Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of MeArm_Lab2_Task1 by
main.cpp
- Committer:
- eencae
- Date:
- 2017-07-04
- Revision:
- 2:2494cdc6977a
- Parent:
- 1:ea13195efe98
- Child:
- 3:13f56160c56e
File content as of revision 2:2494cdc6977a:
/* MeArm Lab 2 Task 1
(c) Dr Craig A. Evans, University of Leeds
July 2017
*/
#include "mbed.h"
#include "MeArm.h"
// create MeArm object - middle, left, right, claw
MeArm arm(p21,p22,p23,p24);
AnalogIn m_pot(p17);
int main()
{
    //                             open , closed
    arm.set_claw_calibration_values(1450,2160);
    //                                  0 , 90
    arm.set_middle_calibration_values(1650,2700);
    arm.set_right_calibration_values(2000,1000);
    arm.set_left_calibration_values(1870,850);
  
    while(1) {
        
        // create x value in range 100 to 200 mm
        float x = 100.0 + 100.0*m_pot.read();
        float y = 0.0;
        float z = 100.0;   
        float claw_val = 1.0;   // 0.0 to 1.0
        
        arm.set_claw(claw_val);
        // move to co-ordinate
        arm.goto_xyz(x,y,z);
        wait(0.2);
        
    }
   
}
            
    