Skip to content

Instantly share code, notes, and snippets.

@makerstorage
Created December 19, 2020 12:31
Show Gist options
  • Select an option

  • Save makerstorage/3aed54befa38c989146f3b04277ada3c to your computer and use it in GitHub Desktop.

Select an option

Save makerstorage/3aed54befa38c989146f3b04277ada3c to your computer and use it in GitHub Desktop.
const int stepPin = 9;
const int dirPin = 8;
void setup() {
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
digitalWrite(dirPin,HIGH);
}
void loop() {
int customDelay = map(analogRead(A0),0,1023,400,1300);
digitalWrite(stepPin, HIGH);
delayMicroseconds(customDelay);
digitalWrite(stepPin, LOW);
delayMicroseconds(customDelay);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment