To interface the Arduino to a LocoNet network, you need to use an interface circuit like the one shown in the schematic below. This came from John Plocher’s SPCoast website where he has designed a LocoNet Shield.
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.
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.