Sub Process_Globals
Public Serial1 As Serial
Private hours, minutes, seconds As Int = 0
Dim alarmhours, alarmminutes, alarmseconds As Int = 0
Private timer1 As Timer
Private lcd As LiquidCrystal
Dim pa0, pa1, pa2, pa3, buzzerpin As Pin
Dim hour_changed, minute_changed, second_changed As Boolean = False
Dim alarmhour_changed, alarmminute_changed, alarmsecond_changed As Boolean = False
Dim mode_changed As Boolean = False
Dim mode As Int = 0
Dim alarm_active As Boolean = False
Dim set As Int = 0
Dim hours2 As Int = 0
Dim day, month, year, set, day2, month2, year2, ret As Int = 0
Dim counter As Int = 0
Dim weekday As String
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
timer1.Initialize("Timer1_Tick", 1000)
pa0.Initialize(pa0.A0, pa0.MODE_INPUT_PULLUP) 'increment time depending on edit mode
pa1.Initialize(pa1.A1, pa1.MODE_INPUT_PULLUP) 'select edit mode
pa2.Initialize(pa2.A2, pa1.MODE_INPUT_PULLUP) 'decrement time depending on edit mode
pa3.Initialize(pa3.A3, pa3.MODE_INPUT_PULLUP)
buzzerpin.Initialize(3, buzzerpin.MODE_OUTPUT)
buzzerpin.DigitalWrite(False)
pa0.AddListener("pa0_StateChanged")
pa1.AddListener("pa1_StateChanged")
pa2.AddListener("pa2_StateChanged")
pa3.AddListener("pa3_StateChanged")
lcd.Initialize(8, 255, 9, Array As Byte (4, 5, 6, 7))
lcd.Begin(16, 2)
lcd.Blink = False
timer1.Enabled = True
'set time and alarm initial values
hours = 10
minutes = 17
seconds = 00
alarmhours = 7
alarmminutes = 45
alarmseconds = 0
day2 = 7
day = 7
month = 05
year = 23
counter = 3
weekday = "Su"