Allan, thanks for the reply. I wrote a simple sketch that does just that. The sensors behave exactly as I want. I came the closest with a fairly long if, else statement:
void loop ()
{
checkForDarkness;
digitalWrite(ROTATE_INTERRUPT, LOW); //switch off rotate interrupt amber LED
//checkSensors;
//delay(60000);
sensorValue_centerPCell = analogRead(centerPCell);
sensorValue_topPCell = analogRead(topPCell);
if (sensorValue_centerPCell <= sensorValue_topPCell)
{
digitalWrite (RELAY_TILT_DOWN, LOW);
digitalWrite (RELAY_TILT_UP, HIGH);
delay(1000);
sensorValue_centerPCell = analogRead(centerPCell);
sensorValue_topPCell = analogRead(topPCell);
}
else if (sensorValue_centerPCell > sensorValue_topPCell)
{
digitalWrite (RELAY_TILT_UP, LOW);
}
else if (sensorValue_topPCell > sensorValue_centerPCell && sensorValue_bottomPCell > sensorValue_centerPCell)
{
digitalWrite (RELAY_TILT_UP, LOW);
digitalWrite (RELAY_TILT_DOWN, LOW);
digitalWrite (SHADED_SENSOR_LED, HIGH);
}
sensorValue_centerPCell = analogRead(centerPCell);
sensorValue_bottomPCell = analogRead(bottomPCell);
if (sensorValue_centerPCell <= sensorValue_bottomPCell)
{
digitalWrite (RELAY_TILT_UP, LOW);
digitalWrite (RELAY_TILT_DOWN, HIGH);
delay(1000);
sensorValue_centerPCell = analogRead(centerPCell);
sensorValue_bottomPCell = analogRead(topPCell);
}
else if (sensorValue_centerPCell > sensorValue_topPCell)
{
digitalWrite (RELAY_TILT_DOWN, LOW);
}
}
It is a clumsy attempt, but this is the stage I am at in the learning curve right now. I know there is an elegant solution, but it continues to elude me.