Hi all, I am a novice in programming Arduino's.
I am trying to use Arduino Uno's to control my model moving bus system (TomyTec). These buses are self driving and are started/stopped by magnets in the road surface. I move a small magnet in the path of the bus or away from the path to stop the bus or to let it go. The magnet is fitted in the arm of a small servo. There are too many servo's to connect to one Arduino so I have two and in future maybe even three Arduino's. So for now I have two Arduino's. The Arduino's control the buses with a sort of block system. I am trying to have two Arduino's communicate to exchange block occupancy data.
The program acts like a PLC program and cycles fast without delays to read sensors, execute the logic and write to servo's every cycle.
I first tried to have the two Arduino's communicate using SoftSerial. So SoftSerial sends data every cycle (every 10 mSec or so). The Servo's went completely crazy and did not stop hunting. After a lot of trying I found that SoftSerial interferes with Servo control. Later I found similar stories in this forum. I fixed the problem somewhat by only sending a new byte through SoftSerial when something actually changed (in my case that will be every minute or so as the buses move around). To receive data, it seems that Servo's are not impacted. Not sure.
Alternatively I may have to use the hardware Serial port. However I wonder how to debug the program since the Serial comms are shared with the USB port. Also when a third Arduino is added to the project, I will need a second serial port anyway.
Does any of you has an alternative solution? Many thanks!