Created
November 4, 2019 02:47
-
-
Save Xhendor/179d7cf2ecfb17409ae78a479665efd9 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
char val; | |
int ledPin12=12;int ledPin13=13; | |
void setup(){ | |
Serial.begin(9600); // Aqui establecemos la velocidad pinMode(ledPin12, OUTPUT); | |
pinMode(ledPin13,OUTPUT); | |
} | |
void loop(){ | |
if(Serial.available())val=Serial.read(); | |
if(val=='1') | |
{ | |
digitalWrite(ledPin12,HIGH); //act. rueda izquierda (giro derecha digitalWrite(ledPin13, LOW); //motor derecho parado | |
} | |
if(val=='2') | |
{ | |
digitalWrite(ledPin12,LOW);//motor izquierdo parado digitalWrite(ledPin13, HIGH); // act rueda derecha. Giro izquierdo | |
} | |
if(val=='3') | |
{ | |
digitalWrite(ledPin13,HIGH);//avanza. los dos motores activos digitalWrite(ledPin12, HIGH); | |
} | |
if(val=='4') | |
{ | |
digitalWrite(ledPin13,LOW);//coche parado digitalWrite(ledPin12, LOW); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment