I have built an electronic candle that has different patterns at various hours of the day. I also built in two different scents that are released via a solenoid valve for 3 seconds at the beginning of some hours, then a fan that runs for another 3 minutes blowing the scent into the air.....that's the plan anyway.
I have used If statement with RTC on other projects but only needed the hour function. Now I need to use the minutes and seconds which shouldn't be difficult! BUT I have tried a variety of codes without success!
Code is attached but the problem these "if" statements are never true and don't execute:
//Red Theme with scent+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if ((now.hour()== 5) && (now.minute() == 0) && (now.second() == (0 || 1 || 2 || 3)))
{
Serial.print("Cyclone Theme befoe Red Theme");
Serial.println();
digitalWrite (rm, HIGH);
cylonRoof () ;
rgbRain ();
digitalWrite(rfan, HIGH);
digitalWrite(rvalve1, HIGH);//Morning scent - most outboard
}
if ((now.hour()== 5) && (now.minute () == 0) && (now.second() >= 3))
{
Serial.print("Cyclone Theme no scent with fan");
Serial.println();
cylonRoof () ;
rgbRain ();
digitalWrite(rvalve1, LOW);//Morning scent off
}
///leaves fan on for 3 minutes before turning off
if ((now.hour()== 5) && ((now.minute() >0) && (now.minute() < 3)))
{
Serial.print("Red Theme no scent w fan off");
Serial.println();
digitalWrite(rfan, LOW);
laserLights () ;
roofRainbow ();
rgbRed();
///Maintains Red Theme for an hour
if ((now.hour()== 6 ) && (now.minute() >=4))
{
Serial.print("Red Theme no scent w fan off");
Serial.println();
laserLights () ;
roofRainbow ();
rgbRed();
}
CM10-clock_reset.ino (14.6 KB)