Skip to content
Kango edited this page Apr 11, 2019 · 5 revisions

Debugging is the Art of finding errors in your code.

There are different basic kinds of errors:

  • The sketch doesn't start but shows an error
  • The sketch does start but throws a runtime error
  • The sketch runs but does something else than you intended

General advice

Run regularly.

When an error occurs:

  • The last part that was changed is guilty for the error.
  • The error is not always in the line that processing indicates.

Use ctrl-t regularly - it gives you auto-format and auto indents. Check the indents. When something is wrong you probably forgot a bracket }

Use println to see where processing is going. Sometimes you think a function A is wrong but in fact the function is never called due to an error in the section that calls the function. To find this error just place a println("here 1"); in function A.

I encourage you to work in small steps. Instead of writing your entire program and then trying to run it, try to write one small part at a time. Then it’s much easier to catch bugs.

Processing 3 comes with Debugging functions, see

https://vimeo.com/140134398

Clone this wiki locally