Tutorial - BASIC Stamp Debugging

Debugging is a simple way to locate and fix errors within your program. It is a very easy thing to do but if not done correctly or not done at all, it is very hard to find an error within your code

Through the use of the debug commands, you are able to detect accidental infinite loops; assure that the math or computations the BASIC Stamp is doing are being done correctly; find and then fix bugs or errors in your code; and altogether become a better programmer!

If you run this program, you will notice that the ASCII character #123("{") will show up in your debug screen. This is usually of no help when you want to know a numerical value. For example, if you would like to count how many times someone clicked a button, you would want to display a DECIMAL value of the variable.

In the above example you may notice in the line DEBUG DEC Debug_Data the "DEC" before Debug_Data. This tells your computer to display the decimal value of the variable.

All of the different formatters are listed below:

? - Displays "[Variable_Name] = [Variable_Value]"; by default the variable is displayed as a decimal value, but you can add a formatter before the "?" to display the variable in a different format(Example: BIN ? Debug_Data will display "Debug_Data = 1111011").***

ASC ? - Displays "[Variable_Name] = [Variable_Value]"; the variable will be displayed in the ASCII format.***

STR - Displays ASCII string from the bytearray(An array of multiple bytes) until byte = 0(This will be when there are no more values stored in the array). Optionally add "\ [Amount of characters to display]" after the variable to only display a certain amount of bytes from the array.

REP - Displays the ASCII a certain amount of times. Must be in this format: "REP [Variable or ASCII character] \ [Amount of times to repeat].

* A "S" may be put before the formatter for a signed value.
** "S" for signed value and/or "I" for indicated value(The "I" must come before the "S" when displaying a Signed, Indicated value)
*** An automatic line feed will be added

SNUM - Does the exact same thing as NUM yet allows for a signed value(-32768 to + 32767).

After any character not used in the formatter is given the value will be sent to the BASIC Stamp. If the BASIC Stamp uses a command like DEC5 then after 5 digits have been submitted, the value will be sent to the BASIC Stamp.

I will not go into much more detail on the formatters because they are the same as the DEBUG command.

Nice work on DEBUG.
You are filling big void in BASIC Stamp programming.

I would suggest you always check the official terminology in Parallax documentation.

For example DEBUG is a command, DEC , ASC etc are formatters, CLS is a control character in DEBUG command.

I think you should avoid generic terms likes "data" or "send".
It is good to use simple terminology, but if you say " to set variable" that is exactly what you doing when using command "DEBUGIN variable".

I also think emphasizing command default options would be nice for a beginner to know.
Sample "DEBUG ? variable" is same as "DEBUG DEC ? variable"

I do not know your background but I would suggest you solicit a "technical and English " editor help before your next post.
Sorry, but I cannot help you with English and really do not have time for technical editing.
Too many honeydoos!!!

For example: using a debug statement after a variable is fine for finding out what it's value is. What if that value is wrong? Placing another debug cmd right before the suspect code can tell you what the value was before you make a change. Sometimes the output is incorrect because the input was incorrect to begin with.