Store and output sensor values from array

There are 8 potentiometers that I want to take the readings from and output using an XBee to another Arduino. I thought that storing the values in an array would be a good way to collect their new postions every 50ms and output that to the other Arduino. Clearly it is not. Does anyone have any suggestions about the best way to do this?

const int analogIn1 = A15;//a potentiometer is connected here
const int analogIn2 = A14; 
const int analogIn3 = A13; 
const int analogIn4 = A12; 
const int analogIn5 = A11; 
const int analogIn6 = A10; 
const int analogIn7 = A9;  
const int analogIn8 = A8;

int Input1 = 0;
int Input2 = 0;
int Input3 = 0;
int Input4 = 0;
int Input5 = 0;
int Input6 = 0;
int Input7 = 0;
int Input8 = 0;

int New_Readings[8] = {Input1,Input2,Input3,Input4,Input5,Input6,Input7,Input8};

void setup(){

void loop(){
  Input1 = analogRead(analogIn1);//new potentiometer position
  Input2 = analogRead(analogIn2); 
  Input3 = analogRead(analogIn3);
  Input4 = analogRead(analogIn4);
  Input5 = analogRead(analogIn5);
  Input6 = analogRead(analogIn6);
  Input7 = analogRead(analogIn7);
  Input8 = analogRead(analogIn8);

  Serial.println(New_Readings);//send array to other Arduino

Ben1234: Clearly it is not.

Why do you say that?

Serial.println(New_Readings);//send array to other Arduino

Assume this actually works (obviously it doesn't) and let's say your values were 10, 20, 30, 40, 50, 60, 70, and 80. Just printing values one by one would result in a transmission of


How is the other Arduino supposed to determine which numbers belong to which values?

When I try to compile it I get the error:

call of overloaded 'println(int [8])' is ambiguous

When I try to compile it I get the error:

call of overloaded 'println(int [8])' is ambiguous

Because it doesn’t know what you want it to do when you tell it to print an array. If you want it to print each element in the array, then just use a for loop:

for (int i=0; i<8; i++)

However, If you want to give the Arduino on the other end a fighting chance of actually decoding what you’re sending it, you should be using start/end characters and deliminators.

int New_Readings[8] = {Input1,Input2,Input3,Input4,Input5,Input6,Input7,Input8};

You seem to be under the impression that this does some kind of binding. That is that changing Inputn later will change the value of New_Readings[n-1]. That is NOT the case.

Get rid of Input1 to Input8 altogether. Just use New_Readings.