My button stopped working

Hi There,

Thanks for taking the time to read my post.

Im developing a alcohol still brewing controller. Iv just added a button to select things on a menu on an lcd.

However when i put an if statement "if (buttonState = 0) {do xyz;} " the Serial.print button state changes to 0 whole time. if i put “if (buttonState = 1) {do xyz;}” then the Serial.print is always 1 regardless of what button is actually doing.

If i remove this if statement then the buttonState prints correctly

Any help appreciated

brew_w_lcd2.ino.ino (7.89 KB)

if (buttonState = 0) {do xyz;}

You must use == in a test so that should be

if (buttonState == 0) {do xyz;}

The way your code is written now it is putting the value 0 into the variable buttonState

...R

Hi, Welcome to the forum.

Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code. It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom. :)

Oh the Man! Thanks heaps, what an idiot haha