/* * 29/06/2017 * HECHO EN ELECTRÓNICA ESTUDIO POR WGB Y SGG * * "CONTROL DE UN CHASIS POR MEDIO DE PLAUSOS" * * MATERIAL PARA EL PRYECTO: * SHIELD PARA DOS MOTORES CLAVE: ARD-100E8 * TRACTOR CON SUPERLLANTA CLAVE: TT-1A * SENSOR DE SONIDO CLAVE: EE-SHT114 */ int LED = 3; int OUTT = 4; int M1D = 10; int M1I = 11; int M2I = 5; int M2D = 6; int CONTA= 0; void setup() { // put your setup code here, to run once: pinMode(LED, INPUT); pinMode(OUTT, OUTPUT); pinMode(M1D, OUTPUT); pinMode(M1I, OUTPUT); pinMode(M2D, OUTPUT); pinMode(M2I, OUTPUT); digitalWrite(OUTT, HIGH); digitalWrite(M1D, LOW); digitalWrite(M1I, LOW); digitalWrite(M2D, LOW); digitalWrite(M2I, LOW); } void loop(){ /*MotorIz_Adela(); //LLAMA FUNCIÓN delay(2000); MotorIz_Atras(); delay(2000); MotorIz_Parado(); delay(2000); MotorDer_Adela(); delay(2000); MotorDer_Atras(); delay(2000); MotorDer_Parado(); delay(2000); */ if (digitalRead (LED) ==LOW){ digitalWrite (OUTT, LOW); //PONER UN JUMPER EN PCB LEYENDA LED delay(50); digitalWrite (OUTT, HIGH); delay(50); CONTA=1; if (CONTA=1){ MotorIz_Adela(); delay (2000); MotorIz_Parado(); delay(2000); } } digitalWrite (LED, HIGH); if(digitalRead (LED)==LOW){ digitalWrite (OUTT, LOW); //PONER UN JUMPER EN PCB LEYENDA LED delay(50); digitalWrite (OUTT, HIGH); delay(50); if (CONTA=2){ MotorDer_Adela(); delay(2000); MotorDer_Parado(); delay(2000); digitalWrite (LED, HIGH); CONTA=1; delay(250); } } } void MotorIz_Adela(){ digitalWrite(M1D, HIGH); digitalWrite(M1I, LOW); } void MotorIz_Atras(){ digitalWrite(M1D, LOW); digitalWrite(M1I, HIGH); } void MotorDer_Adela(){ digitalWrite(M2D, HIGH); digitalWrite(M2I, LOW); } void MotorDer_Atras(){ digitalWrite(M2D, LOW); digitalWrite(M2I, HIGH); } void MotorDer_Parado(){ digitalWrite(M2D, LOW); digitalWrite(M2I, LOW); } void MotorIz_Parado(){ digitalWrite(M1D, LOW); digitalWrite(M1I, LOW); }