Loading...
Pages: [1]   Go Down
Author Topic: brain fart defining inputs  (Read 261 times)
0 Members and 1 Guest are viewing this topic.
Cape Town South Africa
Offline Offline
Edison Member
*
Karma: 17
Posts: 1104
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

We live in the era of the smart phones and stupid people.

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 277
Posts: 25522
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: 17
Posts: 1104
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

We live in the era of the smart phones and stupid people.

Pages: [1]   Go Up
Print
 
Jump to: