I am trying to cause two Uno's to communicate. This is a one way communications from Uno 1 to Uno 2.
Using pin 8 on Uno 1, I set it up for OUTPUT and set its state to LOW. Using pin 2 on Uno 2, I set it up for INPUT and set its state to LOW as well.
The goal is that when I set pin 8 to HIGH on Uno 1, pin 2 on Uno 2 goes HIGH and executes the appropriate code.
The problem is as follows. When I set pin 8 on Uno 1 to HIGH, it stays high which what I want to happen but pin 2 on Uno 2 fluctuates from high to low and back. I need pin 2 on Uno 2 to stay HIGH when pin 8 on Uno 1 is HIGH and when Pin 8 on Uno 1 is LOW, I need pin 2 on Uno 2 to stay LOW.
The attached code is a grade crossing module that I have created for my model railroad. When it is inactive it looks like Gates Up.jpg. An approaching train activates The Grade_Crossing_Final_Update.ino which is loaded in Uno 1, controls the alternating flashing lights and the movement of the gates up and down as shown in Gates Down.jpg. Uno 2 has the DFPlayer_Grade_Crossing_Bell_Update.ino Its sole purpose is to play a mp3 file sound of a Grade Crossing Bell.
I need Uno 1 to demand that Uno 2 start playing and stopping the mp3 files as necessary.
When a train approaches the crossing, the sequence is as follows:
Uno 1 tells Uno 2 to start playing the mp3 file.
Uno 1 starts the flashing lights.
After a 2 second Delay, Uno 1 lowers the gates.
This must be maintained until the train passes the crossing.
When the trains leaves the crossing, the sequence is as follows: