Buttons:
Adcin 0, Switch
Select Case Switch
Case < 1023, > 1015 'Analog value = 1023
Button = 1 'System is in idle mode
Case < 729, > 709 'Analog value = 719
Button = 2 'Switch Select
Case < 482, > 462 'Analog value = 472
Button = 3 'Switch Left
Case < 304, > 284 'Analog value = 294
Button = 4 'Switch Down
Case < 142, > 122 'Analog value = 132
Button = 5 'Switch Up
Case 0 'Analog value = 0
Button = 6 'Switch Right
EndSelect
'=======01234567890123456789=======
Lcdcmdout LcdClear
Lcdcmdout LcdLine1Home
Lcdout #Button
Lcdcmdout LcdLine2Home
Lcdout #Switch
WaitMs 200
Return