#Region Project Attributes
#AutoFlushLogs: True
#CheckArrayBounds: True
#StackBufferSize: 300
#End Region
'Ctrl+Click to open the C code folder: ide://run?File=%WINDIR%\System32\explorer.exe&Args=%PROJECT%\Objects\Src
Sub Process_Globals
Public Serial1 As Serial
Dim aDay , aWeekDay, aMonth, aYear, aHour, aMinute, aSecond As Byte
Dim t As Timer
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
t.Initialize("t_tick", 1000)
Delay(1000)
aDay = 25
aWeekDay = 1
aMonth = 2
aYear = 24
aHour = 18
aMinute = 9
aSecond = 0
RunNative("initialize", Null)
RunNative("setTimeAndDate", Null)
t.Enabled = True
End Sub
Sub t_tick
RunNative("getDay", Null)
RunNative("getWeekDay", Null)
RunNative("getMonth", Null)
RunNative("getYear", Null)
RunNative("getHour", Null)
RunNative("getMinute", Null)
RunNative("getSecond", Null)
Delay(1000)
Log("aDay = " + aDay)
Log("aWeekday = " + aWeekDay)
Log("aMonth = " + aMonth)
Log("aYear = " + aYear)
Log("aHour = " + aHour)
Log("aMinute = " + aMinute)
Log("aSecond = " + aSecond)
Log(" ")
End Sub
#if C
#include <Controllino.h>
void initialize (B4R::Object* o) {
Controllino_RTC_init();
}
void setTimeAndDate(B4R::Object* o) {
Serial.println(b4r_main::_aday);
Controllino_SetTimeDate(b4r_main::_aday, b4r_main::_aweekday, b4r_main::_amonth, b4r_main::_ayear, b4r_main::_ahour, b4r_main::_aminute, b4r_main::_asecond);
}
void getDay(B4R::Object* o) {
b4r_main::_aday = Controllino_GetDay();
}
void getWeekDay(B4R::Object* o) {
b4r_main::_aweekday = Controllino_GetWeekDay();
}
void getMonth(B4R::Object* o) {
b4r_main::_amonth = Controllino_GetMonth();
}
void getYear(B4R::Object* o) {
b4r_main::_ayear = Controllino_GetYear();
}
void getHour(B4R::Object* o) {
b4r_main::_ahour = Controllino_GetHour();
}
void getMinute(B4R::Object* o) {
b4r_main::_aminute = Controllino_GetMinute();
}
void getSecond(B4R::Object* o) {
b4r_main::_asecond = Controllino_GetSecond();
}
#End If