bobbybonez:
I only half understand what they are getting at on this site. I'm looking for something that explains it in a little simpler format.What am I missing for the compound conditionals?
Here is a phrase from your original code:
if (analogRead(sensorpin) >= || == 500) {
digitalWrite(led4, HIGH);
analogWrite(fan, 255);
}
The conditional is the part in parenthesis between "if" and "}", specifically:
(analogRead(sensorpin) >= || == 500).
If you read this in English, it says "analogRead(sensorpin) is greater than or equal to, or (something unspecified) is equal to five hundred". What you want it to say is "analogRead(sensorpin) is greater than or equal to five hundred". Since >= means "greater than or equal to" - the "or" is implicit in the keyword >=. Simplify this expression to read:
(analogRead(sensorpin) >= 500).
You made this error in several places. Correct them all then move on to the next error (the above mentioned missing for.)
Try compiling after each correction, then once it compiles, (Yay!) move on to the optimization that Tom describes in the post right above this one.
ps, you can use the alternate keywords "and' and "or" instead of && and ||. I do this, and it makes it so much easier to read the code!