Printing stored numbers in an Array

Dear All,

I am new to the Arduino World and I would like to request your guidance with the following issue (which is probably going to be very easy for you guys to figure it out).

My objective is to read four (4) different Analog inputs and store them in an Array. Later, I print the results of the array.

This is the code I've written:

const int R1_AI_inputs[] = {A0 , A1, A2, A3};   // Specifies the pins used for the Analog Inputs used for the Current Sensors at Room 1
int R1_analogsensor_[] = {1, 2, 3, 4};          // Initializes the type for the current sensors readings

void setup()
{
Serial.begin(9600); /* Sets up communication with the serial monitor */

void loop()
{ 
for (int count = 0; count < 3; count=count++) {
    R1_analogsensor_[count] = analogRead(R1_AI_inputs[count]);
    delay(10);
  }
    Serial.print("R1_analogsensor_A0: ");
    Serial.println(R1_analogsensor_[0]);
    Serial.print("R1_analogsensor_A1: ");
    Serial.println(R1_analogsensor_[1]);
    Serial.print("R1_analogsensor_A2: ");
    Serial.println(R1_analogsensor_[2]);
    Serial.print("R1_analogsensor_A3: ");
    Serial.println(R1_analogsensor_[3]);
    delay(1000);
   
}

The code is compiling without any errors but I do not see any results at the Serial Monitor. Could you clarify what I am doing wrong?

Kind regards and thank you for your patience.

Marcus

The code did not compile (here).

Try this changed version

const byte R1_AI_inputs[] = { A0 , A1, A2, A3 };   // Specifies the pins used for the Analog Inputs used for the Current Sensors at Room 1
int R1_analogsensor_[4];

void setup() {
  Serial.begin(9600); /* Sets up communication with the serial monitor */
}
void loop()
{
  for (byte count = 0; count < 4; count++) {
    R1_analogsensor_[count] = analogRead(R1_AI_inputs[count]);
    delay(10);
  }
  for (byte sensor = 0; sensor < 4; sensor++) {
    Serial.print("R1_analogsensor_A");
    Serial.print(sensor);
    Serial.print(": ");
    Serial.println(R1_analogsensor_[sensor]);
  }
  delay(1000);
}

Thanks Mr. Whandall.

It's working now.

Kind Regards,

Marcus

count=count++Close, but no cigar.
For interest try your original program (add a brace at teh end of the setup() function) and print count within the for loop to see its value.

count = count++;

You will be one off in you count here!

count = count++ is an undefined construct. I was interpreted differently in IDE 1.6 than it was in version 1.0. Older code broke, because the variable was not increment as it previously was.

Use

count++;
or
++count;
or
count += 1;
or
count = count + 1;