There are a number of libraries you can use when writing your own code.
Two libraries I have used in the past are as follows
1) The MynaBay DCC Library which can be downloaded here… https://github.com/MynaBay/DCC_Decoder
2) The NmraDcc Arduino library can be found in the Arduino Library Manager or downloaded from here: https://github.com/mrrwa/LocoNet/archive/master.zip
3) If you want a sketch to show DCC packets being recieved by the interfaces, this is a great article by Rudy called DCC Sniffer – Packet Analyser with Arduino. This Arduino sketch ‘captures’ the DCC packets as they are transmitted by your Command Station and shows them in a readable format on your PC screen via the Arduino Serial Monitor. You can download it here.