Logical errors occur when your code compiles and uploads, but doesn’t behave the way you want it to. These errors are the trickiest to find and fix because the computer doesn’t give you any feedback about what might be causing problems, like it does with compile and upload errors.

To fix logical errors, read through your program line by line and try to relate what each line is doing to the behavior you’re seeing in your project. The LilyPad does exactly what your program tells it to do; it’s misbehaving because you told it to. Your job now is to find the mismatch between what you want it to do and what the program is telling it to do.

In your read through, look especially for missing statements, delays that are too short or too long, and variables with incorrect values. See page 160 for more information about logical errors and a longer list of common problems.


Logical Errors

<< PREVIOUS      NEXT >>