I am using the servo.h and servo.c files to run servos from the X2. I was successful getting my servo to turn clockwise and counter-clockwise separately, however, when I tried to get the servo to turn one way for a period of time and then the opposite direction, the X2 appears to reset itself without allowing the second turn to execute. Why is this? And how do I fix it?
while ( !checkForButton() )
{
unsigned char broom;
// Some loop variables
unsigned char i;
// Initialize the servo system
servo_init();
// Define our servos to use DC6 and DC7, respectively
broom = servo_define(_SFR_IO_ADDR(DDRC), _SFR_IO_ADDR(PORTD), 7);
servo_active(broom);
servo_set(broom, 1200); //Sweep block in
for(i = 0; i < 5; i++)
{
delay_ms(400);
}
//X2 RESETS ITSELF RIGHT HERE!!!
servo_set(broom, 1600); //Replace broom properly
for(i = 0; i < 5; i++)
{
delay_ms(400);
}