Skip to content

Instantly share code, notes, and snippets.

@HectorTorres
Created January 10, 2018 18:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HectorTorres/ad3917da24a2b59a84397d0dca6731bc to your computer and use it in GitHub Desktop.
Save HectorTorres/ad3917da24a2b59a84397d0dca6731bc to your computer and use it in GitHub Desktop.
int cs =6;
int ud=7;
int decremento=5;
int incremento=4;
int inc;
int dec;
void setup() {
pinMode(cs,OUTPUT);
pinMode(ud,OUTPUT);
pinMode(decremento, INPUT);
pinMode(incremento, INPUT);
digitalWrite(cs, HIGH);
digitalWrite(ud, HIGH);
delay(100);
}
void loop() {
inc=digitalRead(decremento);
delay(100);
if(inc==HIGH)
{
digitalWrite(ud, HIGH);
delay(10 );
digitalWrite(cs, HIGH);
delay(10);
digitalWrite(cs, LOW);
delay(100);
digitalWrite(ud, LOW);
delay(10);
digitalWrite(ud, HIGH);
delay(10);
digitalWrite(ud, LOW);
delay(10);
digitalWrite(cs, HIGH);
delay(100);
}
dec=digitalRead(incremento);
delay(100);
if(dec==HIGH){
digitalWrite(cs, HIGH);
delay(10);
digitalWrite(cs, LOW);
delay(100);
digitalWrite(ud, LOW);
delay(10);
digitalWrite(ud, HIGH);
delay(10);
digitalWrite(ud, LOW);
delay(10);
digitalWrite(cs, HIGH);
delay(100);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment