B4R Question How to repeat SoftRTC alarm on ESP12E?

Aamir Shaheen

New Member
hi,
i am working on egg hatching Machin. For that, i need an alarm when a day passed, i want to get value for "DaysLeft" and "DasPassed". i also need repeating alarm for exhaust fans and writing log to EEPROM. let say i am trying to repeat alarm # 3 but not working.
Trying to repeat SoftRTC alarm.:
private Sub SettingAlarms

    RTC.Initialize("rtc_Alarm",True)
    dt(0) = Century   '21st century (ie 2000)
    dt(1) = Year   'year
    dt(2) = Month    'month
    dt(3) = Day   'day
    'time .. 1:26pm  (zero sec)   (GMT)
    dt(4) = Hour   'hour (0-23)
    dt(5) = Minut   'minute
    dt(6) = LCD_Index     'LCD_Indexs
    dt(7) = 0    'not required.
    RTC.SetClock(dt,0,0)
    RTC.SetAlarm(1,RTC.Sec2DT(RTC.DT2Sec(dt)+(RTC.SECONDS_1DAY*Phase1_Period)))
    RTC.SetAlarm(2,RTC.Sec2DT(RTC.DT2Sec(dt)+(RTC.SECONDS_1DAY*Phase2_Period)))
    RTC.SetAlarm(3,RTC.Sec2DT(RTC.DT2Sec(dt)+5)) '''''''''''''''''''''''''just to say,i want to repeat this alarm with index 3
    RTC.SetAlarm(4,RTC.Sec2DT(RTC.DT2Sec(dt)+(RTC.SECONDS_1MINUTE*30)))
    RTC.SetAlarm(5,RTC.Sec2DT(RTC.DT2Sec(dt)+(RTC.SECONDS_1DAY)))
End Sub

private Sub rtc_Alarm(index As Byte)
    Select index
        Case 0
            LED_Indicator.DigitalWrite(Not(LED_Indicator.DigitalRead))
        Case 1
            Current_Phase=2
        Case 2
            Current_Phase=3
            'End Everyting here
        Case 3
            RTC.CancelAlarm(3)
            RTC.SetAlarm(3,RTC.Sec2DT(RTC.DT2Sec(dt)+5)) '''''''''''' trying to repeat, but not working'
            If Current_Phase<3 Then
                TurnExhaustFanOn()
            End If
        Case 4
            'Write EEPROM here
        Case 5
            DayPassed=DayPassed+1
     End Select
End Sub
 
Last edited:
Top