Pages: [1]   Go Down
Author Topic: brain fart defining inputs  (Read 443 times)
0 Members and 1 Guest are viewing this topic.
Cape Town South Africa
Offline Offline
Edison Member
*
Karma: 19
Posts: 1217
A newbie with loads of posts, and still so much to learn !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset



in one of the first examples "button" there is below..

Code:
int buttonState = 0;         // variable for reading the pushbutton status
//
//

  if (buttonState == HIGH) {    
//
 

Is there anything wrong with defining and setting it to LOW rather than 0 ?  
I know a 0 is logic LOW, but I cant remember why we use both here??
Probably need a coffee....... :o
Logged

With my mobile phone I can call people and talk to them -  how smart can you get ?

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 626
Posts: 34152
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes you can use LOW or false as well as 0.
Logged

Cape Town South Africa
Offline Offline
Edison Member
*
Karma: 19
Posts: 1217
A newbie with loads of posts, and still so much to learn !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Mike,
I think it might have been better in an early example to stick to either one or the other, I got confused and I am an old timer of 2 months :-)
Logged

With my mobile phone I can call people and talk to them -  how smart can you get ?

Pages: [1]   Go Up
Jump to: