Masters:
but when the train passing the sensor
program is busy with for example the print report.
You call the function printReport() 3 times in loop(). You should probably only call it once every 500 or 1000 millisecs.
Printing is slow and loop() should be very fast. Because loop() is very fast your code is almost certainly clogging up the serial system and causing it to block the whole system.
Also don't use delay() in your program. Have a look at how millis() is used to manage timing without blocking in several things at a time
...R