/* PARA TARJETA ARD-100E20 2 DE JUNIO DE 2017 */ //LE DA NOMBRE A LOS SENSORES Y RELEVADORES int RELE3 = 3; int RELE4 = 4; const int SENSORR10 = 10; //SENSOR DE LUZ int STATESENSORR10 = 0; const int SENSOR11 = 11; //SENSOR SEGUIDOR DE LÍNEAS int STATESENSOR11= 0; const int SENSOR12 = 12; //SENSOR DE INCLINACIÓN CON INTERRUPTOR DE MERCURIO int STATESENSOR12 = 0; //setup() corre una sola vez void setup() { // Inicia entrads/salidas pinMode(RELE3, OUTPUT); pinMode(RELE4, OUTPUT); pinMode(SENSORR10, INPUT); // SENSOR DE LUZ digitalWrite(SENSORR10, HIGH); //Activa el pull-up pinMode(SENSOR11, INPUT); //SENSOR SEGUIDOR DE LÍNEAS digitalWrite(SENSOR11, HIGH); //Activa el pull-up pinMode(SENSOR12, INPUT); //SENSOR DE INCLINACIÓN CON INTERRUPTOR DE MERCURIO digitalWrite(SENSOR12, HIGH); //Activa el pull-up } //loop() repite una y otra vez .... void loop() { STATESENSORR10 = digitalRead(SENSORR10); //Lee el estado de los Botones STATESENSOR11 = digitalRead(SENSOR11); STATESENSOR12 = digitalRead(SENSOR12); /* if (STATESENSORR10 == HIGH) { //Checa si se activo el Boton digitalWrite(RELE4, LOW); //Enciende el Led } else { digitalWrite(RELE4, HIGH); //Apaga el Led } if (STATESENSOR12 == HIGH) { //Checa si se activo el Boton digitalWrite(RELE3, LOW); //Enciende el Led } else { digitalWrite(RELE3, HIGH); //Apaga el Led } */ if (STATESENSORR10 == HIGH && STATESENSOR11 ==HIGH && STATESENSOR12 == HIGH) { digitalWrite(RELE3, LOW); digitalWrite(RELE4, LOW); } if (STATESENSORR10 == LOW && STATESENSOR12 == HIGH && STATESENSOR11 == HIGH) { //Checa si se activo el Boton digitalWrite(RELE3, HIGH); //Enciende el Led } if (STATESENSORR10 == HIGH && STATESENSOR12 == LOW && STATESENSOR11 == HIGH) { digitalWrite(RELE4, HIGH); } if (STATESENSORR10 == HIGH && STATESENSOR12 == HIGH && STATESENSOR11 == LOW) { digitalWrite(RELE3, HIGH); digitalWrite(RELE4, HIGH); } }