Created
January 10, 2018 18:35
-
-
Save HectorTorres/ad3917da24a2b59a84397d0dca6731bc to your computer and use it in GitHub Desktop.
This file contains 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
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