"%" Operator Question
D Faust
Posts: 608
I would like to know what the operator of "%" does.· In the stamp manual it says that it declares a number as binary.· I have seen pin declarations given as %10011010.· What would that mean?· How does the stamp know what pins to set to those values?· I also wanted to know what they were used for in this set of code from the thread "make a Boe-Bot follow a line forward and backward."(posted below)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
D Faust
Should I post my question about this code in this thread seeign on how it is related or should I ask on the other thread?· If you can tell me where in the stamp manual to find this, I will look, but I couldn't find it.· Thank you in advance·cutey said...
SELECT qti
CASE %000 ' Forward
GOSUB Front
CASE %010 ' Forward
GOSUB Front
CASE %011 ' Pivot right
GOSUB PRight
CASE %001 ' Rotate right
GOSUB RRight
CASE %110 ' Pivot Left
GOSUB PLeft
CASE %100 ' Rotate Left
GOSUB RLeft
CASE %111 ' Forward
GOSUB Front
.
.
.
.
Back:
PULSOUT 13, 650
PULSOUT 12, 850
RETURN
Front:
PULSOUT 13, 850
PULSOUT 12, 650
RETURN
PRight:
PULSOUT 13, 850
PULSOUT 12, 750
RETURN
RRight:
PULSOUT 13, 850
PULSOUT 12, 850
RETURN
PLeft:
PULSOUT 13, 750
PULSOUT 12, 650
RETURN
RLeft:
PULSOUT 13, 650
PULSOUT 12, 650
RETURN
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
D Faust
Comments
If you were looking at a group of pins, say INA, and you got %1010 it would indicate that P0 was LOW, P1 was HIGH, P2 was LOW and P3 was HIGH.· I hope this helps.· Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
D Faust
http://www.parallax.com/dl/docs/books/edu/Wamv2_2.pdf
http://www.parallax.com/dl/docs/prod/stamps/web-BSM-v2.2.pdf
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
D Faust