Guys & gals
Just playing around with arrays, as I will need to include in a sketch, once finished.
float myfloat[5];
float Temperature = 32.5;
float Humidity = 40;
float Battery = 12.4;
float Light = 0.01;
float Count = 0;
void setup() {
Serial.begin (9600);
myfloat[0] = Temperature;
myfloat[1] = Humidity;
myfloat[2] = Battery;
myfloat[3] = Light;
myfloat[4] = Count;
}
void loop() {
for (int i = 0; i < 5; i++)
{
Serial.println(myfloat[i]);
// myfloat[i]++;
}
Serial.println("");
Serial.println("");
Count = Count + 1;
//Count++;
//myfloat[4] = 1;
delay(2000);
}
I will need to update the values of the 5 variables, so I checked to see ensure that I was doining things correctly. So I just put Count++ at the end of loop(). This didn't increament Count nor did Count = Count+1.
The only way seemed to be to use either of the array commands, myfloat*++ or myfloat[4] = 1.*
Does this mean that when I write to the elements of an array, I have to do it with an array command?
I thought, that by updating the variable, then the array would just extract the updated value.