Hello everybody
As so many others i am very new to this, i have no experience what so ever, but i wat to lern....
My question is: Is there any easy way to get the timer to work in Hour, Minutes and Seconds instead of milliseconds?
My goal is to get a led light to light when the LDR reached a specific value and stay on for, lets say 7 hour and 28 minutes and to stay off untill the next dawn, i think it would be easiest to define the "delay" in Hours and Minutes instead of do the math every time that i want to change the time.
This is what my litle code looks ike at this point:
int Pin = 2; // LED connected to digital pin 2
int photoPin = 0;
int photoReading;
void setup() // The setup() method runs once,
{ // when the sketch starts
pinMode(2, OUTPUT); // initialize the digital pin as an output:
Serial.begin(9600);
}
void loop() // The loop() method runs over and over again,
{ // as long as the Arduino has power
photoReading=analogRead(photoPin);
if (photoReading <400) // This is the darknes value that turns the LED on
{
digitalWrite(2, HIGH);
delay(10000); // Maintains the time that the LED is on
}
else
{
digitalWrite(2, LOW);
}
Serial.println(photoReading);
delay(1000); // The interval that serialmonitor is updating info,
} // in its window
I hope that you guys that have more experience of this can help me with this.
Best Regards
// Leif