const int stepPin = 3;
const int dirPin = 4;
const int led1 = 0;
const int led2 = 1;
const int relay = A0;
void setup() {
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(relay, OUTPUT);
}
void loop() {
digitalWrite(relay, HIGH);
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
int potReading = analogRead(A1);
int del = map(potReading, 1024, 0, 700, 4000);
digitalWrite(dirPin,LOW);
digitalWrite(stepPin,HIGH);
delayMicroseconds(del);
digitalWrite(stepPin,LOW);
delayMicroseconds(del);
}