Hi guys !
I need help!
I need a programming capable of performing a simple function :
When the light is out, or when there is no light, the system needs to identify the exact time and date and show the user.
And when the light is on the ldr, it waits until the light goes out. In other words, it is waiting, in other words, it does nothing.
The Arduino will be connected to the computer at all times.
The programming I use is the simple one of LDR :
//Sensor de luz
int ledPin = 7; //Led no pino 7
int ldrPin = 0; //LDR no pino analígico 8
int ldrValor = 0; //Valor lido do LDR
int ledPin2 = 6; //Led no pino 6
int ldrPin2 = 1; //LDR no pino analígico 8
int ldrValor2 = 0; //Valor lido do LDRvoid setup() {
pinMode(ledPin,OUTPUT); //define a porta 7 como saída
pinMode(ledPin2,OUTPUT); //define a porta 7 como saída
Serial.begin(9600); //Inicia a comunicação serial
}void loop() {
///ler o valor do LDR
ldrValor = analogRead(ldrPin); //O valor lido será entre 0 e 1023
ldrValor2 = analogRead(ldrPin2); //O valor lido será entre 0 e 1023//se o valor lido for maior que 700, liga o led
if (ldrValor>= 700) digitalWrite(ledPin,HIGH);
// senão, apaga o led
else digitalWrite(ledPin,LOW);
//se o valor lido for maior que 700, liga o led
if (ldrValor2>= 700) digitalWrite(ledPin2,HIGH);
// senão, apaga o led
else digitalWrite(ledPin2,LOW);//imprime o valor lido do LDR no monitor serial
Serial.println(ldrValor);
Serial.println(ldrValor2);
delay(100);
}
Explanation: When the value of "ldrValor" and "ldrValor2" is greater than or equal to 700, the Arduino must inform the time and date that this occurs.
If the value of "ldrValue" and "ldrValor2" is less than or equal to 700, the arduino will not do anything (standby).
Important, I am working with 8 ldr's(ldr,ldr2,ldr3,ldr4....), so the timestamp should be independent each.
So can anyone help me with programming?
I would be very grateful !!!!
Thank you!