Wire Cutter Machine

Hi friends

I wrote this program to make a wire cutter machine. But I am facing some problem. I can’t control the delay time. Please help me to complete this program.

Thank you

/* Wire Cutter Machine*/

#include<Servo.h>

int Motor= 3; // The motor push the wire.
int potPin= A0; //A0 is connected with a 50k pot
// to control delay.
int Val= 0;
int Sec= 1000;
int Time= 0;
int pos= 0;

Servo servoPin;

void setup() {

pinMode(Motor, OUTPUT);

Serial.begin(9600);

servoPin.attach(9);// A servo motor is connected with pin D9.
// That connected with a wire cutter

}

void loop() {

Val= analogRead(potPin);

Serial.println(Val);

delay(1);

Time= Sec* Val;

analogWrite(Motor, 100);

delay(Time);

analogWrite(Motor, LOW);

for(pos= 0; pos<= 180; pos+=1){

servoPin.write(pos);

delay(6);
}

for(pos= 180; pos>= 0; pos-=1){

servoPin.write(pos);

delay(6);
}

delay(1000); // This Value can be Change
}

Wire_Cutter_Machine.ino (783 Bytes)

I think you will need to rethink how you are doing the program. Please study this thread to learn how to do what you want.

Paul