Created
December 19, 2020 12:31
-
-
Save makerstorage/3aed54befa38c989146f3b04277ada3c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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