I am making a project where if the push button is pressed, the LCD screen will show a message. But with many trial and errors, it doesn't give the right result.

Here is the circuit:

Here is the code:

#include <LiquidCrystal.h>

// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
#define BUTTON 7
void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  pinMode(BUTTON, INPUT);

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 0);
  // print the number of seconds since reset:
  lcd.print("Press Button");
  lcd.print("to make COFFEE");
  if (digitalRead(BUTTON) == HIGH) {
    lcd.print("SENT TO MACHINE");

2 Answers 2


It looks like you have several issues.

  1. The positive and negative supply "rails" on your prototyping board are not connected together internally. You should add a positive jumper wire.

  2. You are trying to detect when the button provides a HIGH logic level, but there is no possibility of doing so with the current "wiring".

One more thing that could help to determine this, or another possible issue, is a picture of your setup from a different angle so we can see exactly how that button, capacitor, and resistor are connected.

This is the area which would be nice to see from a different angle.

enter image description here

  • I haven't analyzed (yet anyway) their circuit as you have, but message on the LCD indicates that lcd.print("SENT TO MACHINE"); was executed at some point (because of the trailing INE on first line), which seems to cast doubt on "no possibility of doing so". So, you may want to acknowledge it in the answer, if only to dismiss it, assuming it doesn't inform you that something different is going on in their circuit.
    – timemage
    Jul 7, 2022 at 23:29
  • @timemage - You mis-quoted me. It's "You are trying to detect when the button provides a HIGH logic level, but there is no possibility of doing so with the current "wiring".", which is an accurate statement. I also suspect, just like you, the OP's declaration pinMode(BUTTON, INPUT); has turned the input into a radio antenna, and it just happens to trigger the message "SENT TO MACHINE". HINT: The best part of SE is the fact that multiple people can answer the same question.
    – VE7JRO
    Jul 7, 2022 at 23:57
  • The quote seems accurate. Your reply indicates that you've misunderstood what I'm saying. What you're doing right here in this comment is what I meant by acknowledging what is happening on the LCD, if only to dismiss it. Only, not doing it in the answer. What you're saying about the behavior of it without the pullup is inline with what thinking I have done on it. So, no need, to my make own answer. However, your answer can be improved by saying both of these things, in the answer itself.
    – timemage
    Jul 8, 2022 at 0:05
  • @timemage - LOL, every answer on every SE stack can be improved. Instead of complaining about my answer, try posting a better one. I suggest one of those "book report" answers. Use all the tools in the "compose answer tool box", like bold text, italic, H1, H2, etc. Make sure it is the maximum number of chars you can enter (30K or is it 60K now?), because that's exactly what a new user is looking for, right?
    – VE7JRO
    Jul 8, 2022 at 0:18
  • 1
    I appreciate your help! Everything is working (and sorry for the bad angle :/ )
    – James
    Jul 8, 2022 at 17:33

you should implement debouncing because when you press the button with your hand it will bounce and make the signal instable so no High/Low, here's the doc from Arduino:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.