Last active
July 30, 2020 21:03
-
-
Save chepecarlos/b6148c4cb099c5f8ee138fefe10591b0 to your computer and use it in GitHub Desktop.
Codigo de amigo
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
#include <SoftwareSerial.h>//Se puede emular mas de un puerto Serial | |
SoftwareSerial BTSerial(10, 11); // RX | TX Poner los pines que usas | |
char data = 0; | |
int arranque = 0; | |
int enclavamiento = 0; | |
int paro = 0; | |
int estado = 0; | |
int reversible = 0; | |
int areversible = 0; | |
int restado = 0; | |
int renclavamiento = 0; | |
int w = 0; | |
int Led = 12; //modificar para incluir en la variable | |
boolean EstadoAranque = false; | |
void setup () { | |
BTSerial.begin(9600);//Inicializar comunicacion | |
Serial.begin(9600); | |
pinMode(2, INPUT); | |
pinMode(3, INPUT); | |
pinMode(4, INPUT); | |
pinMode(5, INPUT); | |
pinMode(7, OUTPUT); | |
pinMode(8, OUTPUT); | |
pinMode(9, OUTPUT); | |
digitalWrite (9, LOW); | |
pinMode(Led, OUTPUT); | |
delay (10); | |
} | |
void loop () { | |
while (BTSerial.available()) { | |
char data = (char)BTSerial.read(); | |
Serial.print("Dato "); | |
Serial.println(dato); | |
if ( data == 'H') { | |
EstadoAranque = !EstadoAranque; | |
} | |
} | |
if (EstadoAranque) { | |
digitalWrite(Led, 1); | |
} else { | |
digitalWrite(Led, 0); | |
} | |
// paro = digitalRead(3); | |
// | |
// if (paro == HIGH) { | |
// digitalWrite (8, HIGH); | |
// digitalWrite (7, HIGH); | |
// restado = 0; | |
// estado = 0; | |
// } | |
// delay (8); | |
// reversible = digitalRead(4); | |
// arranque = digitalRead(2); | |
// paro = digitalRead(3); | |
// w = digitalRead(5); | |
// enclavamiento = estado; | |
// if (arranque == HIGH and w == HIGH) { | |
// estado = 1; | |
// restado = 0; | |
// } | |
// | |
// if (arranque == HIGH and Led == HIGH) { //Led | |
// estado = 1; | |
// restado = 0; | |
// } | |
// | |
// if (estado == HIGH) { | |
// digitalWrite (7, LOW); | |
// digitalWrite (8, HIGH); | |
// | |
// } else { | |
// digitalWrite (7, HIGH); | |
// } | |
// | |
// if (paro == HIGH) { | |
// estado = 0; | |
// restado = 0; | |
// digitalWrite (8, HIGH); | |
// digitalWrite (7, HIGH); | |
// } | |
// | |
// renclavamiento = restado; | |
// if (reversible == HIGH and w == LOW ) { | |
// restado = 1; | |
// estado = 0; | |
// } | |
// | |
// if (restado == HIGH) { | |
// digitalWrite (8, LOW); | |
// digitalWrite (7, HIGH); | |
// } else { | |
// digitalWrite (8, HIGH); | |
// } | |
// | |
// if (paro == HIGH) { | |
// digitalWrite (8, HIGH); | |
// digitalWrite (7, HIGH); | |
// restado = 0; | |
// estado = 0; | |
// | |
// } | |
// | |
// if (reversible == HIGH and w == HIGH) { | |
// estado = 0; | |
// restado = 0; | |
// } | |
// | |
// if (arranque == HIGH and w == LOW) { | |
// estado = 0; | |
// restado = 0; | |
// } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment