These guidelines may be useful to you if your circuits are not working as planned:
Check the Microcontroller Control Register Settings
Sometimes you have to configure multiple control settings before you can enable a pin for a particular purpose (input, output, A/D conversion, etc). Section 2.3.2 of the MCU datasheet describes the control registers related to various ports. Sometimes you may have to look in other parts of the datasheet (for example, the A/D section) for more details on enabling / setting a particular peripheral.
Check Your IDE Settings
Verify that the file you are editing is the same one the compiler is set to compile and the debugger/serial monitor is set to load to the correct target. This can be a problem if you have multiple targets or multiple projects open.
Check Your Debugger
Remember that you have to press the Green Arrow / F5 / Run > Start command in the debugger before the program you’ve loaded will begin executing.
Point-to-point Wiring Check
Wiring mistakes are easy to make. If possible, have someone other than the person who wired the circuit check it for mistakes. This procedure will give you a methodical way to check the wiring. This method is more reliable than tracing wires, especially if there are a lot of overlapping wires on your board, or many that are the same color.
Start with a schematic of your circuit. If you don’t have a circuit, draw one out. No circuit is “too simple” to need a schematic. If the circuit is simple, the schematic should be easy to draw.
Verify each connection on the circuit using the multimeter. Some multimeters have a continuity checker which will ring when a low-resistance connection is made. Even if your multimeter doesn’t have this feature, set it for the lowest resistance setting. If you read 0 (or very low number of ohms) between the test leads, they are wired together.
Use a highlighter to mark each connection on the schematic as your