Following on from the calculator, an obvious use of a button matrix is for a PIN entry keypad.
Bear in mind that this project is only demonstrating keypad functionality, nothing else.
If you took steps to obscure script details, the wifi connection would still be vulnerable.
So although you might use it to make something kiddy-proof, it will not offer high security.
But any protection is better than none, as long as it isn't relied upon. The default myPIN$ = "1234", but you would obviously change that, with perhaps more digits.
You could check for more than 1 PIN and branch to handle them differently, if wished.
I have a hardware door access keypad outside my 'man-cave' lab, this offers it remote access.
When the PIN entry matches the embedded myPIN$ then the LED turns green and any commands in the 'authorised' subroutine are actioned (ie: perhaps momentary relay contacts).
All entries that don't match the embedded PIN cause the LED to turn red and actions any commands found in the 'unauthorised' subroutine (perhaps issue an alert or log the attempt).
Always use ★ button first to clear out old contents, then input the PIN, followed by #.
Basic:
'keypad
option lowram 12000
cls
ok = 0
gosub unauthorised
myPIN$ = "1234"
d$ = "0"
a$ = ""
a$ = a$ + |<style>|
a$ = a$ + | #mytable { background-color:#444444; |
a$ = a$ + |border-radius:.8em;|
a$ = a$ + |border: .15em solid black;}|
a$ = a$ + |#mytable button {width:2.1em;background: #333333;font:2em/1.3em arial; border-radius: .1em;}|
a$ = a$ + |#mytable button:hover {background: dimgray;background:radial-gradient(#999999,#666666);}|
a$ = a$ + |</style>|
a$ = a$ + |<br><br><br><br>|
a$ = a$ + |<div id="mytable" style='display: table; margin-right: auto; margin-left: auto;' > |
a$ = a$ + |<table style="text-align: center; " border1="1"|
a$ = a$ + | cellpadding="3" cellspacing="5">|
a$ = a$ + | <tbody>| a$ = a$ + | <tr>| a$ = a$ + |<td colspan="4" style=";">| a$ = a$ + led$(ok,"dcss") + |</td>| a$ = a$ + | </tr>| a$ = a$ + | <tr>| a$ = a$ + cssid$("bred","color:tomato;") a$ = a$ + cssid$("bblue","color:lightblue;") a$ = a$ + cssid$("bgray","color:lightgray;") a$ = a$ + cssid$("bwhite","color:white;") a$ = a$ + cssid$("byellow","color:yellow;") a$ = a$ + |<td>| + button$("1",b1,"bgray") + |</td>| a$ = a$ + |<td>| + button$("2",b2,"bgray") + |</td>| a$ = a$ + |<td>| + button$("3",b3,"bgray") + |</td>| a$ = a$ + | </tr>| a$ = a$ + | <tr>| a$ = a$ + |<td>| + button$("4",b4,"bgray") + |</td>| a$ = a$ + |<td>| + button$("5",b5,"bgray") + |</td>| a$ = a$ + |<td>| + button$("6",b6,"bgray") + |</td>| a$ = a$ + | </tr>| a$ = a$ + | <tr>| a$ = a$ + |<td>| + button$("7",b7,"bgray") + |</td>| a$ = a$ + |<td>| + button$("8",b8,"bgray") + |</td>| a$ = a$ + |<td>| + button$("9",b9,"bgray") + |</td>| a$ = a$ + | </tr>| a$ = a$ + | <tr>| a$ = a$ + |<td>| + button$("★",bstar,"bgray") + |</td>| a$ = a$ + |<td>| + button$("0",b0,"bgray") + |</td>| a$ = a$ + |<td>| + button$("#",bhash,"bwhite") + |</td>| a$ = a$ + | </tr>| a$ = a$ + | </tbody>| a$ = a$ + |</table>| a$ = a$ + |</div>| html a$ a$ = "" wait b1: d$ = d$ + "1" return b2: d$ = d$ + "2" return b3: d$ = d$ + "3" return b4: d$ = d$ + "4" return b5: d$ = d$ + "5" return b6: d$ = d$ + "6" return b7: d$ = d$ + "7" return b8: d$ = d$ + "8" return b9: d$ = d$ + "9" return b0: d$ = d$ + "0" return bstar: d$ = "" refresh return bhash: if d$ = myPIN$ then gosub authorised else gosub unauthorised refresh return authorised: ok = 1 return unauthorised: ok = 0 return '------------- End -----------------