#include #define RX 2 #define TX 1 #define LED_OUT A3 SoftwareSerial CustomSerial(2,1); const long A = 1000; //Resistencia en oscuridad en KΩ const int B = 27; //Resistencia a la luz (10 Lux) en KΩ const int Rc = 10; //Resistencia calibracion en KΩ int value; int ilum; bool overrideON = false; void setup() { CLKPR = (1<1020){ CustomSerial.println("Button pressed"); overrideON = !overrideON; } if((ilum>100 && ilum<1000)|| overrideON){ // Light needed, turn light ON digitalWrite(LED_OUT,HIGH); } else { //Too dark (night) or too bright (Direct sunshine) //light not needed, turn light OFF digitalWrite(LED_OUT,LOW); } delay(1000); // Wait for 250 millisecond(s) }