Go Down

Topic: brain fart defining inputs (Read 521 times) previous topic - next topic

Boffin1



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

Code: [Select]

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

Grumpy_Mike

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

Boffin1

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 :-)

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy