#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
Public lcd As LiquidCrystal_I2C
Public my_keypad As MyKeypad_I2C
Public taste As Byte
Dim timer1 As Timer
'Dim d1pin As D1Pins
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
lcd.Initialize(0x27, 20, 4) 'based on the example from the project.
lcd.Backlight = True
lcd.Write("System gestartet")
lcd.SetCursor(0,0)
timer1.Initialize("timer1_Tick",1000)
timer1.Enabled=True
my_keypad.Initialize(0x38)
my_keypad.clearAllKeyCodes()
my_keypad.setKeyCode(0xEE,1) ' Prg-1
my_keypad.setKeyCode(0xDE,2) ' Prg-2
my_keypad.setKeyCode(0xBE,3) ' Reset
my_keypad.setKeyCode(0x7E,4) ' Pin
my_keypad.setKeyCode(0x7D,5) ' Start
my_keypad.setKeyCode(0xBD,6) ' +1
my_keypad.setKeyCode(0xDD,7) ' +5
my_keypad.setKeyCode(0xED,8) ' +10
End Sub
Sub timer1_Tick
taste = my_keypad.receiveKey(1) ' nur 1 x abfragen
lcd.SetCursor (0,1)
If taste = 1 Then lcd.Write("Prg-1 ")
If taste = 2 Then lcd.Write("Prg-2 ")
If taste = 3 Then lcd.Write("Reset ")
If taste = 4 Then lcd.Write("Pin ")
If taste = 5 Then lcd.Write("Start ")
If taste = 6 Then lcd.Write("+1 ")
If taste = 7 Then lcd.Write("+5 ")
If taste = 8 Then lcd.Write("+10 ")
lcd.SetCursor (0,2)
lcd.Write(Millis) ' this stop at crash
End Sub