Hi, trying to get a servo working on channel 1 of the pololu mini maestro and i just can't get it to work.
I'm also getting the red light which means searial communication error.
I am certain that the wiring is correct.
Here is the Code:
void setup()
{
Serial.begin(9600);
}
void loop()
{
put(0,3000);
while(1) //stop it from looping
{
}
}
void put(int servo, int angle)
{
//servo is the servo number (typically 0-7)
//angle is the absolute position from 500 to 5500
unsigned int temp;
unsigned char pos_hi,pos_low;
unsigned char buff[6];
temp=angle&0x1f80; //get bits 8 thru 13 of position
pos_hi =temp>>7; //shift bits 8 thru 13 by 7
pos_low =angle & 0x7f; //get lower 7 bits of position
//Send a Pololu Protocol command
Serial.print(0xAA, BYTE); //start byte
Serial.print(0x0C, BYTE); //device id
Serial.print(0x04, BYTE); //command number
Serial.print(servo, BYTE); //servo number
Serial.print(pos_hi, BYTE); //bits 8 thru 13
Serial.print(pos_low, BYTE); //bottom 7 bits
}
{/code]
Any help would be appreciated.