Go Down

Topic: Last stage debugging - Help !![SolveD] (Read 3 times) previous topic - next topic

wildbill

#25
Mar 07, 2013, 06:43 pm Last Edit: Mar 08, 2013, 01:43 pm by wildbill Reason: 1
What I'm suggesting is that the sections like this:
Code: [Select]
  if (pump_Status == true)
    {
      Serial.print(" Pump Status : ACTIVE ");
      Serial.println();
    }

  else if (pump_Status == false)
    {
      Serial.print(" Pump Staus : INACTIVE ");
      Serial.println();
    }


Could be replaced by a call like this:
Code: [Select]

DisplayStatus("Pump",pump_Status);


Where the DisplayStatus Function is:
Code: [Select]

void DisplayStatus (char* Title,boolean Status)
{
Serial.print(Title);
if(Status)
  Serial.println(" ACTIVE);
else
  Serial.println(" INACTIVE");
}

lloyddean

It's simple really.  Conditional tests such as used in 'if', 'while', 'do while', and several others, evaluate to zero as false and not zero as not false.

The 'bool' values 'false' and 'true' have specific values - 'false' is always zero while 'true' may be any non-zero value depending upon the language version.

Here is an easy to read article concerning conditionals in C++

<http://www.cplusplus.com/forum/articles/3483/>

taz3m

Hello,

Im back again after some workings on the code.

I added up from the previous revision, an lcd 16x2, with some new lines in the code, but here im stuck with some bugs in the code.

My temperature part of the code is not giving me values. I suspected some wiring went wrong, however, when i test the temperature code alone, it works as nice as it should be. . .

With this new revision i added the lcd, and some menu to be displayed like, intro menu, soile percentage menu and LDR Raw reading. . I went through a pushbutton to swap between menus.

Here also without pressing my button, the lcd is changing menu.

Find herewith attached my code. Any suggestions where i can tackle for this bug.

Thanks in advance . .



tz
.....

lloyddean

#28
Mar 10, 2013, 07:37 pm Last Edit: Mar 10, 2013, 07:42 pm by lloyddean Reason: 1
I'm curious why this continues to linger in your code -

Code: [Select]

if (FanStatus == true);{
FanControlOFF ();
}


taz3m

Oops was busy adding new lines and forgot about modification.

A small recap please,  ^_^ . .

I need not to test for a boolean if it is true or not right ?

intead of above i should i be using something likewise :

Quote from: lloyddean

And didn't you mean -

Code: [Select]

    if ( ! FanStatus )
    {
        FanControlON();
    }
    else
    {
        FanControlOFF();
    }




Im getting to it, now :smiley-sweat: .. thanks again . . 
tz
.....

Go Up