Well I’m back and very close to completion, as you’ve seen in the last video, it is nearly there, I’ve had to wait for parts and fitting them but it now has a pneumatic ram to push the tin opener up, I’m having an issue where I can’t get the dc motor for the claw to open while the pneumatic ram pushes up for 9 seconds, I want the ram and the dc motor (for the claw) to work at the same time,
Here’s my code so far;-
#include <MobaTools.h>
const byte step_pin = 3;
const byte dir_pin = 2;
const byte step2Pin = 5;
const byte dir2Pin = 4;
const byte button1 = 8;
const byte button2 = 9;
const byte button3 = 37;
MoToStepper stepper1( 800, STEPDIR );
MoToStepper stepper2( 800, STEPDIR );
int signal_pin = 53;
int relay1 = 49;
int relay2 = 47;
int relay3 = 43;
int relay4 = 41;
int dir;
int solenoide = 10;
int led = 13;
int buzzer = 11;
int steps = 4400;
void setup() {
pinMode(signal_pin, OUTPUT);
pinMode(button3, INPUT_PULLUP);
pinMode(relay1, OUTPUT);
pinMode(relay2, OUTPUT);
pinMode(relay3, OUTPUT);
pinMode(relay4, OUTPUT);
digitalWrite(relay1, HIGH);
digitalWrite(relay2, HIGH);
digitalWrite(relay3, HIGH);
digitalWrite(relay4, HIGH);
pinMode(dir_pin, OUTPUT);
pinMode(step_pin, OUTPUT);
digitalWrite(step_pin, LOW);
digitalWrite(dir_pin, LOW);
pinMode(button1, INPUT_PULLUP);
pinMode(button2, INPUT_PULLUP);
pinMode(solenoide, OUTPUT);
pinMode(led, OUTPUT);
//Setting up the steppers
stepper1.attach( step_pin, dir_pin );
stepper1.setSpeedSteps( 12000 );
stepper1.setRampLen( 10 );
stepper2.attach( step2Pin, dir2Pin );
stepper2.setSpeedSteps( 12000 );
stepper2.setRampLen( 10 );
}
void loop() {
while (digitalRead(button1) == HIGH)
{
}
delay(1000);
int i = 0;
do {
i++;
tone(buzzer, 455);
delay(320);
noTone(buzzer);
delay(500);
} while (i <= 0);
digitalWrite(solenoide, HIGH);
digitalWrite(led, HIGH);
delay(250);
digitalWrite(solenoide, LOW);
digitalWrite(led, LOW);
while (digitalRead(button2) == HIGH)
{
}
digitalWrite(relay1, LOW);
digitalWrite(relay2, LOW);
delay(650);
digitalWrite(relay1, HIGH);
digitalWrite(relay2, HIGH);
stepper1.writeSteps( -steps );
delay(1650);
stepper2.writeSteps( -300 );
while ( stepper1.moving() || stepper2.moving() );
digitalWrite(signal_pin, HIGH); // I need relays 1,2,3,4 to work at the same time as this delay
delay(9000);
digitalWrite(signal_pin, LOW);
delay(1500);
stepper1.doSteps( 1800 );
while ( stepper1.moving() );
stepper2.doSteps( -4000 );
while ( stepper2.moving() );
delay(400);
stepper2.doSteps( 4300 );
while ( stepper2.moving() );
stepper1.writeSteps( 0 );
while ( stepper1.moving() );
digitalWrite(relay3, LOW);
digitalWrite(relay4, LOW);
delay(600);
digitalWrite(relay3, HIGH);
digitalWrite(relay4, HIGH);
}
I also need the last part with relays 1,2,3,4 to work at the same time as stepper1 moving to zero,
As always I am great full for all the help,
Thanks,
Phil.