Speed Control
Speed Control
Speed Control
int p;
float delay_time=500;
void setup() {
Serial.begin(9600);
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
pinMode(enPin,OUTPUT);
digitalWrite(enPin,LOW);
void loop() {
p = analogRead(potmeterPin);
delay_time = map(p,0,1023,500,1000);
motorStep(1);
digitalWrite(stepPin,HIGH);
delayMicroseconds(delay_time);
digitalWrite(stepPin,LOW);
delayMicroseconds(delay_time);