i am doing a project in which i am displaying various sensor data on oled ,i am using esp8266 nodemcu with dht11 sensor and lm35 sensor for now
i am trying to display one sensor value in oled for each time i press a button like 1 then one sensor value is displayed on screen ,2 then another sensor value and so on but all sensor values are displayed at same time so i am quit confused
this is my program is there something wrong with my program?
the forum is not allowing to post the program as it exceed 9000 characters so ino file is attached
for reliable operation, it's common practice to wire the button switch between the input and ground and configure the pin with a pull-up resistor, INPUT_PULLUP, so that when the button is pressed it pulls the input pin LOW.
Have a look at the reference for switch....case, you forgot to put the break; at the end of each case, that caused the code to continue past the end of the case and into the subsequent cases.
i tried the pull up and have inserted break at the end of each case
now i get the one sensor value on the screen
but i have to press multiple times to get it to change to next case