Coding debug error []
PwnSalad
Posts: 8
Here is the code:' {$STAMP BS2}
' {$PBASIC 2.5}
letter VAR Word
land VAR Byte
letter1 VAR Word
A VAR Byte
B VAR Byte
E VAR Byte
F VAR Byte
land = 0
letter1 = 0
numbers VAR Word
letters VAR Word
Choice VAR Word
DEBUG "Press 1 to go up, and 2 to go down."
Control:
DO
DEBUGIN NUM letter
IF letter = 1 THEN letter1 = letter1 + 5
IF letter = 2 THEN letter1 = letter1 + 10
IF letter = 3 THEN letter1 = letter1 - 5
IF letter = 4 THEN letter1 = letter1 - 10
IF letter > 127 THEN letter1 = 127
IF letter1 > 127 THEN letter1 = 127
IF letter = 9 THEN land = 1
IF land = 1 THEN GOSUB intervalcheck
DEBUG CLS
DEBUG SDEC ? letter
DEBUG SDEC ? letter1
LOOP WHILE land = 0
IF land = 1 THEN GOSUB intervalcheck
intervalcheck:
DEBUG "Initiating landing sequence"
PAUSE 1500
DEBUG CLS
DEBUG letter1
IF letter1 =< 0 THEN GOSUB timeforbed
IF letter1 > 20 THEN GOSUB largesteps
IF letter1 =< 20 THEN GOSUB babysteps
largesteps:
DO
IF letter1 => 127 THEN letter1 = letter1 - 10
IF letter1 =<20 THEN GOSUB babysteps
LOOP
babysteps:
DO
IF letter1 =<20 THEN letter1 = letter1 - 5
IF letter1 =<0 THEN GOSUB timeforbed
LOOP
timeforbed:
END
When you run the code it should check to see how big the steps should go down by, but when it debugs letter1, the main variable, it debugs as [].
Run the code
type in 200 to set it to 127
then hit 9
Help please.
' {$PBASIC 2.5}
letter VAR Word
land VAR Byte
letter1 VAR Word
A VAR Byte
B VAR Byte
E VAR Byte
F VAR Byte
land = 0
letter1 = 0
numbers VAR Word
letters VAR Word
Choice VAR Word
DEBUG "Press 1 to go up, and 2 to go down."
Control:
DO
DEBUGIN NUM letter
IF letter = 1 THEN letter1 = letter1 + 5
IF letter = 2 THEN letter1 = letter1 + 10
IF letter = 3 THEN letter1 = letter1 - 5
IF letter = 4 THEN letter1 = letter1 - 10
IF letter > 127 THEN letter1 = 127
IF letter1 > 127 THEN letter1 = 127
IF letter = 9 THEN land = 1
IF land = 1 THEN GOSUB intervalcheck
DEBUG CLS
DEBUG SDEC ? letter
DEBUG SDEC ? letter1
LOOP WHILE land = 0
IF land = 1 THEN GOSUB intervalcheck
intervalcheck:
DEBUG "Initiating landing sequence"
PAUSE 1500
DEBUG CLS
DEBUG letter1
IF letter1 =< 0 THEN GOSUB timeforbed
IF letter1 > 20 THEN GOSUB largesteps
IF letter1 =< 20 THEN GOSUB babysteps
largesteps:
DO
IF letter1 => 127 THEN letter1 = letter1 - 10
IF letter1 =<20 THEN GOSUB babysteps
LOOP
babysteps:
DO
IF letter1 =<20 THEN letter1 = letter1 - 5
IF letter1 =<0 THEN GOSUB timeforbed
LOOP
timeforbed:
END
When you run the code it should check to see how big the steps should go down by, but when it debugs letter1, the main variable, it debugs as [].
Run the code
type in 200 to set it to 127
then hit 9
Help please.
Comments
need help
2) Maybe you're asking about the DEBUG statement in intervalcheck? Do you want something like DEC or SDEC in front of the "letter1"?
I did a debug ? dec letter1 and it worked
Also no where in the rules does it say anywhere against bumping, It's not impolite its just saying : "Hey Im still here and no one has answered my question."
It's about about as impolite as raising your hand in class.
Just closing the loop: http://forums.parallax.com/showthread.php?134682-Forum-Guidelines