Author Options:

Arduino coding for 3 push buttons and some wordings to be appear in LCD? Answered

I am new to Arduino and have yet to gain enough knowledge about it. I have read up some sites about push button but i still don't quite get it. I want to have my first push button being press, and the LCD appears push button 1 is pressed. But when i release it, LCD will appear push button 1 is released. However when the second push button is press, the LCD will appear push button 2 is pressed. But when i release it, LCD will appear push button 2 is released. This applies to the third push button too. Anyone know how to program the coding?




5 years ago

Please bear in mind im arduino new too. hooking up an arduino brand lcd doesnt seem to complex, theres a setup command , then youve got the print(display) command,(i havnt done it!!)

arduino likes doing one thing at a time(quickly tho) ,so i think you will be ok if thats what you want it to do. (i was trying to get multiple things happening at once, please give it a look) i think your code will start something like this......

serial lcd display thingy , // presuming u buy one that compatible has logo on the box,u can just tell it run a lcd shield
int value1 = 0
int value2 = 0
 // this stuff tell the arduino what its gonna be looking for button wise

void setup () 
pinMode (1,INPUT);
pinMode (2,INPUT);  
// your telling arduino what pins the buttons are attached to
void loop()    // the program lives here
{    //* it will repeat this area 
value1 = digitalRead(1); value2 = digitalRead(2);   // tell it to listen to its buttons
if (value1== HIGH) {print "button 1 blah blah"}
if (value1== LOW) {print "button 1 isnt blah blah"}
if (value2== HIGH) {print "button 2 blah blah"}
if (value2== LOW) {print "button 2 isnt blah blah"}

so this might work you will have to see if it behaves, otherwise you may need to get it to wait or delay.i havnt used much of the timing code to be honest. or there is the && ..  if ((value1== LOW)&&(value2== LOW)) {print "button 1 isnt blah blah"}
i dont know but the print command might be able to have a for how long number at the end like the tone command .  tone( pin number, frequency in hz , for how many milliseconds)

if you feel the need to vent some discord whilst on your learning curve i created this forum page for that purpose 


5 years ago

If you can't understand a pushbutton, you're not ready for the coding for the LCD. Have you got a WORKING LCD ?