Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
how to take multiple inputs from keypad using inkey command??
i want to make security system , for which i hav to take multiple inputs ,
main:
Cls
Print $FE,$C0,"enter password"
DelayMS 30
GoSub key1
DelayMS 500
GoSub key2
DelayMS 500
GoSub key3
DelayMS 500
Cls
GoSub diplay:
DelayMS 1000
GoTo main
key1:
countKey = InKey
DelayMS 20
If countKey<>16 Then
Select countKey
Case 0: key=1
Case 1: key=6
Case 2: key=7
Case 4: key=2
Case 5: key=5
Case 6: key=8
Case 8: key=3
Case 9: key=4
Case 7: key=0
Case 10: key=9
End Select
Else
GoTo key1
EndIf
numnew=key
numstore=numnew
Return
key2:
countKey1 = InKey
DelayMS 20
If countKey1<>16 Then
Select countKey1
Case 0: key11=1
Case 1: key11=6
Case 2: key11=7
Case 4: key11=2
Case 5: key11=5
Case 6: key11=8
Case 8: key11=3
Case 9: key11=4
Case 7: key11=0
Case 10: key11=9
End Select
Else
GoTo key2
EndIf
numnew1=key11
numstore1=numnew1
Return
key3:
countKey2= InKey
DelayMS 20
If countKey2<>16 Then
Select countKey2
Case 0: key22=1
Case 1: key22=6
Case 2: key22=7
Case 4: key22=2
Case 5: key22=5
Case 6: key22=8
Case 8: key22=3
Case 9: key22=4
Case 7: key22=0
Case 10: key22=9
End Select
Else
GoTo key3
EndIf
numnew2=key22
numstore2=numnew2
Return
diplay:
If numstore=1 Then
If numstore1=2 Then
If numstore2=3 Then
Print At 1,1 ,"correct pasword"
Toggle PORTC.2
Else
Print At 1,1 ,"incorrect"
Print At 2,1 ," pasword"
EndIf
EndIf
EndIf
Return
function getkey() as byte
dim keymask as byte
dim key as byte
dim index as byte
keymask = 0xef
For index = 0 To 3
PORTB = keymask
WaitUs 100
key = PORTB And 0xf
If key = 0xf Then key = 0
If key = 0xe Then key = 1
If key = 0xd Then key = 2
If key = 0xb Then key = 3
If key = 0x7 Then key = 4
If key > 0 Then
key = key + (index * 4)
Gosub beep
getkey = LookUp(0, 6, 7, 8, 9, 5, 11, 12, 10, 1, 2, 3, 4), key
Goto finkey
Endif
keymask = ShiftLeft(keymask, 1)
Next index
getkey = 0
finkey:
end function
Dim mouse As 2
Dim countKey As Byte
Dim key As Byte
Dim numstore[3] As Byte
Dim aloop As Byte
main:
Cls
DelayMS 30
Print At 1,1,"enter num"
DelayMS 500
GoSub x1
p:
DelayMS 100
Cls
Print At 1,1,Str numstore
DelayMS 1000
GoTo main
x1:
For aloop=0 To mouse Step 1
DelayMS 100
Cls
Print "press key"
x2:
DelayMS 50
countKey=InKey
If countKey<>16 Then
Select countKey
Case 0: key="1"
Case 1: key="6"
Case 2: key="7"
Case 4: key="2"
Case 5: key="5"
Case 6: key="8"
Case 8: key="3"
Case 9: key="4"
Case 7: key="0"
Case 10: key="9"
Case 12: key="a"
Case 13: key="b"
End Select
Else
GoSub x2
EndIf
numnew=key
numstore[aloop]=numnew
DelayMS 30
Next
GoTo p