Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save makerstorage/a38461d647636f313d5a69e8f08300c6 to your computer and use it in GitHub Desktop.
int dirPin= 8;
int stepPin = 9 ;
void setup() {
pinMode(dirPin, OUTPUT);
pinMode(stepPin, OUTPUT);
attachInterrupt(0,kesme,RISING);
Serial.begin(9600);
digitalWrite(dirPin,HIGH);
}
void kesme()
{
digitalWrite(dirPin, !digitalRead(dirPin));
}
void loop() {
for(int i = 0 ; i<200;i++){
digitalWrite(stepPin, HIGH);
delayMicroseconds(1500);
digitalWrite(stepPin, LOW);
delayMicroseconds(1500);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment