Self-diagnose components in the circuit
You could get your program to output messages to the serial pin on your board, Tx. For example:

Serial.begin(9600) //baud rate of 9600

Serial.print("Debug Message");


You can use this to print out string and integers. Here is the link to further information on the Arduino website - https://www.arduino.cc/en/reference/serial

If you are already using the Serial pins then you could use the SoftwareSerial Library - https://www.arduino.cc/en/Reference/softwareSerial

This library allows you to make two other pins on your board Tx and Rx. For example:

SoftwareSerial mySerial(12,13) //Makes pin 12 Rx and pin 13 Tx

mySerial.begin(9600) //baud rate of 9600

mySerial.println("Debug Message");


To read the output from any of the pins on your arduino - use a USB to TTL serial cable. Plug it into your computer and use a program like PuTTY to connect to the serial cable and read the messages coming from the Arduino.