| Posted: 07:53am 28 Nov 2022 |
|
|
|
Not elegant, just a bit shorter. Still needs work.
'Character Selector - brief press pin 4 button to save character, ' long press after last character to save name & exit CLS Font 2 '12x20 SetPin 4,din,pullup :SetPin 5,din,pullup :SetPin 6,din,pullup For n=1 To 52:carat$=carat$+" ":Next 'Make marker MID$(carat$,26)="^" x=14 : done=0 vpos = 100 For n=2 To 27 'make A - Z Text n*MM.Info(FONTWIDTH),vpos,Chr$(n+63) Next Text 1,vpos+MM.Info(FONTHEIGHT),Mid$(carat$,x) Do Do While Pin(4) And Pin(5) And Pin(6) : Loop ' wait for a button press If Pin(6)=0 Then Inc x,-1 If x<1 Then x=1 :Print x, Text 2*MM.Info(FONTWIDTH),vpos+MM.Info(FONTHEIGHT),Mid$(carat$,27-x) Do : Loop Until Pin(6) 'wait for button release EndIf If Pin(5)=0 Then Inc x, 1 If x>26 Then x=26 :Print x, Text 2*MM.Info(FONTWIDTH),vpos+MM.Info(FONTHEIGHT),Mid$(carat$,27-x) Do : Loop Until Pin(5) 'wait for button release EndIf If Pin(4)=0 Then Timer = 0 name$=name$+Chr$(x+64) Print x,Chr$(x+64),name$ Do : Loop Until Pin(4) Or (Timer > 1500) 'wait for button release or finished If Timer > 1500 Then done=1 EndIf Loop Until done Text 100, vpos+3*MM.Info(FONTHEIGHT),name$ Print name$ |