user74049: 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.setCursor(0,1);
  lcd.print("to make COFFEE");
  if (digitalRead(BUTTON) == HIGH) {
    lcd.clear();
    lcd.print("SENT TO MACHINE");
  }
}


user37523: It looks like you have several issues.

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

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.


74049: <p>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.</p>
<p>Here is the circuit:
<a href="https://i.stack.imgur.com/zhv7W.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zhv7W.jpg" alt="" /></a></p>
<p>Here is the code:</p>
<pre><code>#include &lt;LiquidCrystal.h&gt;

// 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(&quot;Press Button&quot;);
  lcd.setCursor(0,1);
  lcd.print(&quot;to make COFFEE&quot;);
  if (digitalRead(BUTTON) == HIGH) {
    lcd.clear();
    lcd.print(&quot;SENT TO MACHINE&quot;);
  }
}
</code></pre>
 37523: <p>It looks like you have several issues.</p>
<ol>
<li><p>The positive and negative supply &quot;rails&quot; on your prototyping board are not connected together internally. You should add a positive jumper wire.</p>
</li>
<li><p>You are trying to detect when the button provides a <code>HIGH</code> logic level, but there is no possibility of doing so with the current &quot;wiring&quot;.</p>
</li>
</ol>
<p>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.</p>
<p>This is the area which would be nice to see from a different angle.</p>
<p><a href="https://i.stack.imgur.com/Vq3G8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Vq3G8.jpg" alt="enter image description here" /></a></p>
