Is digitalWrite(ledPin1,false);
the same as
digitalWrite(ledPin1, LOW);
Thanks,
Sid
Is digitalWrite(ledPin1,false);
the same as
digitalWrite(ledPin1, LOW);
Thanks,
Sid
Yes. Also the same as digitalWrite(ledPin1, 0);
--Michael
Thanks,
I looked for false but saw no examples.
Sid
Easy enough to test if you've got your board handy.
--Michael
I believe you.
Sid
I looked for false but saw no examples.
Because that is not the way that false was meant to be used.
The digitalWrite() function expect HIGH or LOW as the second argument.
While false, LOW, and 0 are all the same value, NAMES ARE IMPORTANT TO PEOPLE!
I was looking at some code from VernierAnalogStore for a data logger. They do use HIGH and LOW for switches but in many places they use true and false. They seem professional and its a fairly complex program so I thought there might be a good reason.
Sid
Horrible idea!
The keyword false conveys a logic state, while LOW is a component state; two different animals. Keep in mind that what you write as code also serves as documentation for your code. Using false to denote what should be LOW is just plain sloppy and I doubt if there are many companies that would hire someone who wrote code like that.
Good information. I had no intention of using false, it sounds confusing. Just curious, thought I might be missing something.
Thanks for the responses.
Sid
The thing is, false is defined by the language to be zero, whereas LOW is merely defined by Arduino to be zero.