DigitalRead - use 0 and 1, or HIGH and LOW ?

Hi

When reading the state of an output pin to an int variable, is it acceptable to use HIGH / LOW as the result in an IF statement ?

int Status1 = 0;
        Status1 = digitalRead(OutPin6);
        if (Status1 == HIGH){    // or is it better to use   0  /  1  ?

You can use either.

You can use "Serial.println(HIGH)" to see how HIGH is defined.

jremington:
You can use either.

You can use "Serial.println(HIGH)" to see how HIGH is defined.

Thank You

You even test the state of a pin without explicitly using either HIGH/LOW or 0/1 or a variable

if (digitalRead(OutPin6))
{
  //do stuff 
}

The code is actually testing for true which is yet another synonym for HIGH and 1. Strictly it is testing for not zero, but the effect is the same Personally I prefer to use HIGH/LOW for tests of pin states as that is how I visualise them

By the way, is the pin in question an input to the Arduino or an output from the Arduino ? All of the above will work either way but it is more usual to give pins names in relation to the Arduino or even better to give them names related to their function