RTC timer help


hello,

i learning how use rtc different time functions (ds1307, ds3231). want make on/off delay timer based on rtc don't know how.

i want have 5 seconds delay before turn led on or off, after switch pressed. took code previous project, based on millis() , change can use rtc seconds after rollover, stops working. understand why don't know how fix it.

i can't find tutorials learn how use different rtc time functions.

current code idea..
code: [select]

delaytime = 5;  // 5 seconds

    if ((switch == high) && (now.second() - ontime >= delaytime))
  {
    digitalwrite(led, high);
    offtime = now.second();   
  }
    else if ((switch == low) && (now.second() - offtime >= delaytime))
  {
    digitalwrite(led, low);
    ontime  = now.second();
  }


i tried play little futuretime function, found didn't know how use it. appreciate or turorial link handling rtc functions.

you want use rtc instead of millis ( ) because cannot handle on millis ( ) ?


Arduino Forum > Using Arduino > General Electronics > RTC timer help


arduino

Comments

Popular posts from this blog

Convierte tu Raspberry en un NAS. Firmware fvdw-sl 15.3 - Raspberry Pi Forums

Rasperry Wifi LAN Controller - Raspberry Pi Forums

Unlock car with bluetooth and car key