Go Down

Topic: momentary switch button LCD (Read 225 times) previous topic - next topic


Oct 21, 2015, 02:14 pm Last Edit: Oct 21, 2015, 02:17 pm by Rockypete1
 :o hello

im trying to make 1 or more momentary push button to toggle the display of the screen so...

for example, press swtich_1 will direct to display about the temperature, then if the switch_2 is pressed then it will display on the Voltage display reading so on and so forth...please help me...

Im using Mega2560
im also using 1.77 inch GTFT LCD module display
and using simple momentary push switch button...

i've done some research some say used J-K flip flop or D flip flop

some say used OP amp inverters with pull up resistor circuit diagram

some say just alternate the software by using Boolean structure

ATM im using external interrupts-_-

here some example :


void setup()
    attachInterrupt(digitalPinToInterrupt(pin),ISRfunction, CHANGE);


 void loop()
   buttonState = digitalRead(SW1);
   if(!buttonState == HIGH)
     digitalWrite(pin,state);  //interrupts the routine
      number1();          //displays the voltage
     number2();        //displays the tempt reading "ish"

 void ISRfunction()

here's another one (dont work anyways):

//Boolean structure------------------------------------------------------

boolean buttonState = flase; // store for toggle state, flase = off true = on

if(yourButton == HIGH && buttonState == false) // if button is pressed and toggled off
     number1();  //displays voltage reading

     buttonState = true // set button state to on

if(yourButton == HIGH && buttonState == true) // if button is pressed and toggled on
    number2(); //displays tempt reading

     buttonState = false // set button state to off

HELP ME!  :smiley-confuse:


Right, first things first.

Go and read the instructions, then go back and modify your post to mark up each code snippet as such so we can examine it comfortably and reliably.

Go Up