Password Checker
I have typed this in from the old manual.
I cannot get it to work.
It downloads without errors.
' {$STAMP BS2}
' {$PBASIC 2.5}
'PasswordChecker.bs2
'Check password entered in Debug Terminal's Windowpane.
Password DATA "pass!"
index VAR Nib
temp VAR Byte
userEntry VAR Byte(5)
DO
DEBUG "Enter password: "
DEBUGIN STR userEntry \5
FOR index = 0 TO 4
READ Password + index, temp
IF temp <> userEntry(index) THEN EXIT
NEXT
IF index <> 5 THEN
DEBUG CR, "Password not correct. ",CR
ENDIF
LOOP UNTIL index = 5
DEBUG CR, "Password is correct;", CR, "program can continue..."
END
Comments
I tried "12345" in quotes and it worked. It will not accept text.
Can you "attach" the saved BS2 source code file?
The key is in this line:
Password DATA "pass!"
If you type "pass!" without the quotes it should work.
A few minutes later...
The program works as intended.
Does not work on mine when I downloaded your file. It does work if I change it to : 12345
The 12345 has to be in quotes i.e., "12345"
I just found the problem. For some reason the button at the bottom of the Debug Terminal went into Pause. I had to hit resume then it worked.
I have to do that each time.
Thanks for verifying that the program worked. I can now finish the chapter in the book.