Totally Lost

I'm trying to help my 10 year old son with a project and I know nothing about C++.

We want to cycle a motor if the temp >= 80 degrees and reverse the motor if the temp <= 80 degrees. I tried to create a variable that toggled based on whether the motor had run or not. I keep getting the following error:

"exit status 1
lvalue required as left operand of assignment"

What does that mean? When I search for that error in other topics, I don't even understand the issues they're dealing with. I've tried reading through Language Reference page but I still can't piece it together.

Here's the portion of the code that keeps getting errors:

{
if (temp >= 80 && RunVariable = 0); //temperature equal or above 80F

small_stepper.setSpeed(500); //Max seems to be 500
Steps2Take = 2048; // Rotate CW
small_stepper.step(Steps2Take);
delay(2000);
RunVariable = 1;
break;
}

{
if (temp <= 80 && RunVariable = 1); //temperature equal or above 80F

(small_stepper.setSpeed(500)); //Max seems to be 500
Steps2Take = -2048; // Rotate CCW
small_stepper.step(Steps2Take);
delay(2000);
RunVariable = 0;
break;
}

If you have an answer, please explain like I'm a complete newbie (which I am). Thank you!

if (temp >= 80 && RunVariable = 0); <---<<< NO ;

if (temp >= 80 && RunVariable = 0); <---<<< NO ;

Read this:

Always show us the complete sketch, use the code tags icon in the posting menu </>

if (condition)
{
//statement(s)
}

Why are you using break; ?

Ah! Thank you!

larryd:
if (temp >= 80 && RunVariable = 0); <---<<< NO ;

if (temp >= 80 && RunVariable = 0); <---<<< NO ;

BOTH of those if statements are not testing IF RunVariable is equal to 0. They are BOTH SETTING RunVariable to 0.

'=' is the arithmetic assignment operator
'==' is the arithmetic equality operator

Regards,
Ray L.

Was hoping the OP would have discovered = vs == from the url given.

RayLivingston:
They are BOTH SETTING RunVariable to 0.

and return 'true' as a test value (assignments always do) mind you, this code does compile though doesn't it ?

taichichick:
We want to cycle a motor if the temp >= 80 degrees and reverse the motor if the temp <= 80 degrees.

So, if the temperature is exactly 80 degrees, then what happens?

Deva_Rishi:
and return 'true' as a test value (assignments always do) mind you, this code does compile though doesn't it ?

In the case of if (RunVariable = 0), no, the assignment returns 0, or a "false" test value. An assignment always "returns" the value that's assigned to the variable.

You can get explanations and examples (not Arduino oriented but still useful) of the instructions and language usage at http://www.cplusplus.com/reference/