Thank you, Grumpy_Mike. From your input and a little bit of research, it seems like that would be the best solution. I appreciate the idea; I wish I had your knowledge going into the project.
I am a bit disappointed that Arduinos cannot read two inputs simultaneously.. that bums me out a bit. I have no interest in trying port manipulation, like TomGeorge suggested.. I think I would break something ahaha.
I will do even more research into Shift Registers. I have already bought all the components I would need (I think), including the capacitors. When the time comes that I inevitably have more questions with my code, I will reach out.
In below (simple) example, your Uno will set the data on its pins based on received serial data. This only supports characters '0'..'9' (numbers 0..9). Once it has processed the received data (the for-loop in loop(), the Uno sets a pin HIGH telling the Mega that the data is valid.
const byte outputPins[] = {2, 3, 4, 5, 6, 7};
const byte strobePin = A3;
void setup()
{
Serial.begin(115200);
for (byte outputCnt = 0; outputCnt < sizeof(outputPins); outputCnt++)
{
pinMode(outputPins[outputCnt], OUTPUT);
}
pinMode(strobePin, OUTPUT);
}
void loop()
{
// reset output pins
for (byte outputCnt = 0; outputCnt < sizeof(outputPins); outputCnt++)
{
digitalWrite(outputPins[outputCnt], LOW);
}
// set strobe low
digitalWrite(strobePin, LOW);
// check if there is serial data
if (Serial.available() > 0)
{
// read serial input;
char ch = Serial.read();
if (ch >= '0' && ch <= '9')
{
// convert to number
ch -= '0';
for (byte outputCnt = 0; outputCnt < sizeof(outputPins); outputCnt++)
{
if((ch & (1 << outputCnt)) == (1 << outputCnt))
{
digitalWrite(outputPins[outputCnt], HIGH);
Serial.print("Pin ");
Serial.print(outputPins[outputCnt]);
Serial.println(" set to HIGH");
}
}
// tell the Mega that the data is valid
digitalWrite(strobePin, HIGH);
Serial.println("Telling Mega that data is valid");
// pulse for 50 milliseconds
delay(50);
// because loop() is called repeatedly, the next time that loop() is called, data and the strobe are removed
}
}
}
The last code in post #24 will be the companion. I've tested this Uno code.