Problems with Pololu Servo Controler

05 Nov 2010 . Edited: 05 Nov 2010

Hi,

I am new to the mbed platform. After i recived my kit i have tried a lot of the examples in the cookbook.

Now i wanted to use my pololu Servo Controler on the mbed. Unfortunatly i have an error in my Programm and the servo does not move a bit.

pololu_class

I think my error is in the Command sequence.

 

void pololu_mssc::move(int p_servo, int p_angle)
    {
        char pos_hi,pos_low;
        int temp;
        
    
        //Convert the angle data into two 7-bit bytes
        temp   = p_angle & 0x1f80;
        pos_hi = temp >> 7;
        pos_low= p_angle & 0x7f;
    
        //Construct and send a Pololu Protocol command sentence
        _mssc -> putc(0x80);    //start byte
        _mssc -> putc(0x01);    //device id
        _mssc -> putc(0x04);    //command number
        _mssc -> putc((char) p_servo); //servo number
        _mssc -> putc(pos_hi);  //angle data1
        _mssc -> putc(pos_low); //angle data2
    }

 

 

Pin layout

Thank you for your help