The BASIC Stamp solves math problems in the order they are written; from left to right. The
result of each operation is fed into the next operation. So to compute -
Unlike the BASIC Stamp, the PBP Compiler performs all math operations in full hierarchalCode:12 + 3 * 2 / 5 ...the BASIC Stamp goes through a sequence like this: 12 + 3 = 15 15 * 2 = 30 30 / 5 = 6
order. This means that there is precedence to the operators.
Multiplies and divides are performed before adds and subtracts, for example:
Forcing the addition first with parenthesis like: (12 + 3) * 2 / 5 would return the correctCode:12 + 3 * 2 / 5 ...PBP goes through a sequence like this: 3 * 2 = 6 multiply first 6 / 5 = 1.2 divide second (the .2 is lost) 12 + 1 = 13 add last
result. Good stuff to remember when porting BASIC Stamp code over to PBP.
I haven't played with a BASIC Stamp in years, but once I looked in the Stamp editor help
file under PBASIC Operators, it was obvious. I'm glad you got it working. Looks like a
fun project.
Maybe you could post your final version in the code examples section? Could save someone
else using the Parallax RFID components with PBP a lot of head-scratching...;o}




Bookmarks