I am trying to read 4 analog inputs with one Arduino (transmitter), create an array for the values, and send the values via serial connection to a second Arduino (receiver). The receiver uses the values to operate buzzers and lights based on the values of each of the 4 channels. I am satisfied that my transmitter (shown below) is sending the correct values for the array, but I'm stumped on how to write a code to read the four values into an array on the receiver side. I mapped the analog values from 0-9 to hopefully make the code a little simpler on the receiver side.
Can anyone please help with a suggestion for my receiver? Thanks.
void loop()
{
Data[0] = map(analogRead(CH1), 0, 1023, 0, 9);
Data[1] = map(analogRead(CH2), 0, 1023, 0, 9);
Data[2] = map(analogRead(CH3), 0, 1023, 0, 9);
Data[3] = map(analogRead(CH4), 0, 1023, 0, 9);
for(i=0; i<4; i++){
Serial.println(Data);
}