Hi, I am pretty much a noob so please be gentle with me!
I am trying to set up a camera slider that moves a camera (Stepper Motor X), pans (Stepper Motor Y) and then focuses and releases the shutter. (Foucus has to be high whilst shutter is on to take a picture)
I am currently using an Uno CNC shield to help with the stepper motor control
I am currently struggling to get everything going in the correct order and I can't figure out why.
Start again.
The code I currently have is below where am I going so wrong?
The sequence I would like would be
Stepper X 200 Steps
Stepper Y 20 Steps
Focus on for 4 secs before
Shutter on 1/2 sec
Shutter off
Focus off
Loop to start. Eventually I will add a microswitch to stop movement at the end of the track but I'll worry about that later!
const int StepX = 2;
const int DirX = 5;
const int StepY = 3;
const int DirY = 6;
const int Shutter = 4;
const int Focus = 7;
void setup() {
pinMode(StepX,OUTPUT);
pinMode(DirX,OUTPUT);
pinMode(StepY,OUTPUT);
pinMode(DirY,OUTPUT);
pinMode(Shutter,OUTPUT);
pinMode(Focus,OUTPUT);
}
void loop() {
void SliderMotor ();
{
digitalWrite(DirX, HIGH);
for(int x = 0; x<200; x++) { // loop for 200 steps
digitalWrite(StepX,HIGH);
delayMicroseconds(500);
digitalWrite(StepX,LOW);
delayMicroseconds(500);
delay(3000);
}
// delay for 3 second
void PanMotor ();
{
digitalWrite(DirY, LOW);
for(int x = 0; x<20; x++) { // loop for 20 steps
digitalWrite(StepY,HIGH);
delayMicroseconds(500);
digitalWrite(StepY,LOW);
delayMicroseconds(500);
delay(3000);// delay for 3 second
}
void Shutter();
{
digitalWrite(Focus,HIGH);//focus camera on
delayMicroseconds(4000);
digitalWrite(Shutter, HIGH);//take picture
delayMicroseconds(500);
digitalWrite(Shutter,LOW);
delayMicroseconds(1000);
digitalWrite(Focus,LOW);
delayMicroseconds(4000);
}
}}}
Sorted thanks to the delay issue! Thanks everyone! I’ll be back asking for help with inputs to control the slider motor movement and stop switches next! Thank you all!