Shows the current positions of the 4 servos on the display...

Dependencies:   PR_RobotArmController mbed

main.cpp

Committer:
jah128
Date:
2017-03-03
Revision:
0:c1930e7050d1

File content as of revision 0:c1930e7050d1:

#include "robotarm.h"

Robotarm arm;

int main()
{
    //Run the main initialisation routine
    arm.init();
    display.clear_display();
    while(1) {
        int base = servo.GetPosition(BASE);
        int shoulder = servo.GetPosition(SHOULDER);
        int elbow = servo.GetPosition(ELBOW);
        int wrist = servo.GetPosition(WRIST);
        char s1[17];
        char s2[17];
        sprintf(s1,"B:%4d S:%4d",base,shoulder);
        sprintf(s2,"E:%4d W:%4d",elbow,wrist);
        display.set_position(0,0);
        display.write_string(s1);
        display.set_position(1,0);
        display.write_string(s2);
        wait(0.2);
    }
}