The LocoNet Arduino library can be found in the Arduino Library Manager or downloaded from here: https://github.com/mrrwa/LocoNet/archive/master.zip
To interface the Arduino to a LocoNet network, you need to use an interface circuit like the one shown in the schematic below, which came from John Plocher’s SPCoast website where he has designed several LocoNet Shields. Alternatively for personal experimenting with LocoNet there is also a Minimal LocoNet Interface shown further down the page.
You MUST connect the RX input to the AVR ICP pin which on an Arduino UNO is digital pin 8. The TX output can be any Arduino pin, but the LocoNet library defaults to digital pin 6 for TX. John’s LocoShield uses digital pin 7. The TX pin used is defined in the init(uint8_t txPin) function.
The Minimal LocoNet Interface Circuit is shown below. If you want to try a simple interface for prototyping, then you can “get away with” the interface below, but it should not be used on commercial products.