val = digitalRead(10); Serial.println(val);
I assigned pin 10 to be an input and turned on the pullup resistors, and val is an integer, but with the above setup running in my main loop i get 0 in the serial monitor whether I bring pin 10 to ground or not. If i change the serial monitor to show: Serial.println(digitalRead(10)); then it displays as it should when I'm changing the pin high and low.
Does anyone have any idea what's going on? It seems to work in other programs this way but not in mine. Any help would be appreciated. Thank you!