for (int p = 0; p < numberOfSensors != i != j !=k !=l !=m !=n !=o; p++) {
now[p] = analogRead(ldr_pins[p]);
for (int q = 0; q < numberOfSensors != i != j !=k !=l !=m !=n !=o !=p; q++) {
now[q] = analogRead(ldr_pins[q]);
for (int r = 0; r < numberOfSensors != i != j !=k !=l !=m !=n !=o !=p !=q; r++) {
now[r] = analogRead(ldr_pins[r]);
Now I'm confused.
Here is what I have in mind. It compiles, but I haven't tested because I don't have all those sensors:
const byte numberOfSensors = 10;
const int THRESH = 200; // Threshold value
const byte counterPin = A10; // Counter pin
const byte ldr_pins [numberOfSensors] = { A0, A1, A2, A3, A4, A5, A6, A7, A8, A9};
int now [numberOfSensors] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int then [numberOfSensors] = { 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000};
void setup()
{
pinMode(counterPin, OUTPUT); //Sets Counter to OUTPUT
pinMode(13, OUTPUT); //Sets Pin 13 the LED to Output
Serial.begin(9600);
} // end of setup
void loop()
{
// read sensors
for (int i = 0; i < numberOfSensors; i++)
now[i] = analogRead(ldr_pins[i]);
// check each one
for (int i = 0; i < numberOfSensors; i++)
{
// change over threshold?
if (abs (then [i] - now[i]) > THRESH)
{
Serial.print ("Someone ");
if (now [i] > then [i])
{
Serial.print ("sat on");
digitalWrite(counterPin, HIGH); // hit counter
}
else
{
Serial.print ("got up from");
}
Serial.print (" bench ");
Serial.println (i);
} // end of over threshold
} // end of checking each sensor
// remember for next time
for (int i = 0; i < numberOfSensors; i++)
then [i] = now [i];
delay (100); // brief delay
digitalWrite(counterPin, LOW);
} // end of loop