Page 1 of 1

variables defined

Posted: Wed Jan 23, 2013 5:57 pm
by rossbryant1956
working with this bit of code:

Code: Select all

void StandardHeater2(byte HeaterRelay, int LowTemp, int HighTemp)
{
    if (ReefAngel.Params.Temp[T2_PROBE] == 0) return;  // Don't turn the heater on if the temp is reading 0
    if (ReefAngel.Params.Temp[T2_PROBE] <= LowTemp && ReefAngel.Params.Temp[T2_PROBE] > 0) ReefAngel.Relay.On(HeaterRelay);  // If sensor temperature <= LowTemp - turn on heater
    if (ReefAngel.Params.Temp[T2_PROBE] >= HighTemp) ReefAngel.Relay.Off(HeaterRelay);  // If sensor temperature >= HighTemp - turn off heater
where are those three variables defined; I imagine HeaterRelay is the port where the StandardHeater2 is plugged in, LowTemp and HighTemp are what they seem; but can't find where the original coder defined those variables.

He does have this snippet in the loop section, is this it?

Code: Select all

StandardHeater2( Box1_Port6,776,780 ); //SumpHeater
Thx in advance.

variables defined

Posted: Wed Jan 23, 2013 6:13 pm
by lnevo
Probably as globals. Do you have a link to the coders full pde?

You can declare them above the setup() function.

Edit... Sorry just reread what was written... The variables are seclared as part of the function definition...

So when you say

void StandardHeater2(byte heaterrelay, int lowtemp, int hightemp)

Thats where the variables are declared...

When you call the function

StandardHeater2(Box1_Port6, 776, 780)

The variables get assigned...

Re: variables defined

Posted: Wed Jan 23, 2013 6:29 pm
by rossbryant1956
Thanks, very helpful.