2011_ACTIVITY #4 - DEVELOPING AND ADDING A SOFTWARE SUBSYSTEM

2011_ACTIVITY #4 - DEVELOPING AND ADDING A SOFTWARE SUBSYSTEM

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
' What's a Microcontroller - PasswordChecker.bs2 ' Check password entered in Debug Terminal's Transmit Windowpane. ' ' {$STAMP BS2} ' {$PBASIC 2.5} ' Password DATA "pass!" ' Store "secret" password here. index VAR Nib ' Index variable. temp VAR Byte ' Stores single char. userEntry VAR Byte(5) ' Store user entered password. p DO D DEBUG "Enter password: " ' User instructions. DEBUGIN STR userEntry \5 ' Get user input password. FOR index = 0 TO 4 ' Check array against DATA READ Password + index, temp
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ' Get next password char IF temp <> userEntry(index) THEN EXIT ' Compare to user input, NEXT ' exit if not equal. IF index <> 5 THEN ' If exit, then index not equal DEBUG CR,"Password not correct.", CR ' to 5 and pass is not correct. ENDIF LOOP UNTIL index = 5 ' Only get out of loop when ' index = 5. DEBUG CR, "Password is correct;", CR, ' Program can move on when "program can continue. .." ' password is correct. END...
View Full Document

Ask a homework question - tutors are online