Created
October 28, 2018 02:25
-
-
Save fenixec/6d9cf20884d32b3057e7e62c7690bd99 to your computer and use it in GitHub Desktop.
Auto HackatonFenix
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
const int s1 = 2; | |
const int s2 = 4; | |
const int m1 = 9; | |
const int m2 = 10; | |
void setup() { | |
pinMode(m1,OUTPUT); | |
pinMode(m2,OUTPUT); | |
pinMode(s1,INPUT); | |
pinMode(s2,INPUT); | |
} | |
void loop() { | |
if(digitalRead(s1)== HIGH && digitalRead(s2)== HIGH) | |
{ | |
analogWrite(m1,200); | |
analogWrite(m2,200); | |
} | |
if(digitalRead(s1)== HIGH && digitalRead(s2)== LOW) | |
{ | |
analogWrite(m1,200); | |
analogWrite(m2,0); | |
} | |
if(digitalRead(s1)== LOW && digitalRead(s2)== HIGH) | |
{ | |
analogWrite(m1,0); | |
analogWrite(m2,200); | |
} | |
if(digitalRead(s1)== LOW && digitalRead(s2)== LOW) | |
{ | |
analogWrite(m1,0); | |
analogWrite(m2,0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment