Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

where to search (servo jitter)
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

where to search (servo jitter)

by jo on Mon Mar 24, 2008 5:13 pm

the servo is jittering, whenever the second stepper was activated

maybe you have an idea where the problem may come from

another thing i am wondering:
attach servo to pin 9 is servo2 on shield
attach servo to pin 10 is servo1 on shield
my guess was pin9 = servo1, pin10 = servo2

thats my code:

#include <AFMotor.h>
#include <ServoTimer1.h>

AF_Stepper Motor_Hor(200, 1); // horizontal
AF_Stepper Motor_Ver(200, 2); // vertikal
ServoTimer1 servo1;

byte LU_pics_per_row = 5;
byte LU_no_of_rows = 2;
int LU_current_pic = 0;
int LU_wait_for_cam_ready = 1000; // millisecs Cam-Pause
int LU_servo_angle = 90;

long steps_per_pic_hor = 400;
long steps_per_pic_ver = 400;

//---------------------------------

void setup() {

Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Pan test!");

Motor_Hor.setSpeed(200); // 200 rpm
Motor_Ver.setSpeed(200); // 200 rpm
Motor_Hor.release();
Motor_Ver.release();

servo1.attach(9);
servo1.write(LOW);
}

//---------------------------------
void loop() {

LU_current_pic = 0;

// loop to get pics

for (int i_v=0; i_v <= LU_no_of_rows; i_v++)
{
// Serial.println(LU_current_pic);
for (int i_h=0; i_h < LU_pics_per_row; i_h++)
{
pan_move_hor(steps_per_pic_hor, FORWARD);
pan_shutter();
}
pan_move_ver(steps_per_pic_ver, FORWARD);
}

// DONE
Motor_Hor.release();
Motor_Ver.release();

}
//---------------------------------

byte pan_move_hor(int steps, byte dir)
{
Serial.println("Hori");
Motor_Hor.step(steps, dir, INTERLEAVE);
delay (1000);
}

byte pan_move_ver(int steps, byte dir)
{
Serial.println("Vert");
Motor_Ver.step(steps, dir, INTERLEAVE);
delay (1000);
}

byte pan_shutter()
{
LU_current_pic ++;
Serial.println(LU_current_pic);
Serial.println("wait");
delay(LU_wait_for_cam_ready);
// Servo
Serial.println("Shutter");
servo1.write(LU_servo_angle);
delay(500);
servo1.write(LOW);
delay(500);
}
jo
 
Posts: 1
Joined: Mon Mar 24, 2008 5:04 pm

by adafruit on Thu Mar 27, 2008 6:23 pm

is it just the second stepper that does it?
could it possibly be a power problem?

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

Please be positive and constructive with your questions and comments.