Skip to content

Instantly share code, notes, and snippets.

@samirsogay
Created August 23, 2019 15:59
Show Gist options
  • Save samirsogay/991402247b7f0f74d617230249c97753 to your computer and use it in GitHub Desktop.
Save samirsogay/991402247b7f0f74d617230249c97753 to your computer and use it in GitHub Desktop.
int A = D1; //EN1
int B = D2; //EN2
int C = D3; //IN1
int D = D4; //IN3
long del = 15000;
void setup() {
pinMode(A, OUTPUT);
pinMode(B, OUTPUT);
pinMode(C, OUTPUT);
pinMode(D, OUTPUT);
digitalWrite(A, HIGH);
digitalWrite(B, HIGH);
}
void one(){
digitalWrite(C, LOW);
digitalWrite(D, HIGH);
delayMicroseconds(del);
}
void two(){
digitalWrite(C, LOW);
digitalWrite(D, LOW);
delayMicroseconds(del);
}
void three(){
digitalWrite(C, HIGH);
digitalWrite(D, LOW);
delayMicroseconds(del);
}
void four(){
digitalWrite(C, HIGH);
digitalWrite(D, HIGH);
delayMicroseconds(del);
}
// the loop routine runs over and over again forever:
void loop() {
for (int i=0; i<=500; i++){
one();
two();
three();
four();
}
// delay(2000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment