Screen and Motor Code Not working

I’ve created arduino code for a project that has a screen and a motor all controlled by the button. I’ve attched everything to a breadboard as per this Fritzing schematic but the screen still will not turn on (the motor works but not the screen or the button) what am i doing wrong? Any help really apreciated!

I have attached schematic diagram and code!

lcd_motor.ino (1.58 KB)

In that picture, the button is not wired to anything.

In your code, you don't initialise the LCD until the button is pushed for 2 sec, which will never happen if the button is not wired up.

(It would have been better to ask here in your thread. I'm sure there are others who can explain better than me.)

Your button has 2 sides: left and right.
The right side is connected to ground, with the black wire, so the voltage there is always zero.
The left side is connected to 5V through a 10kΩ resistor.

Normally, those 2 sides are not connected, but when you press the button, they are connected together, until you release the button again.

In your code, you read from a digital pin to determine whether the button is pressed.
Can you tell which pin? In your fritzing picture, that pin is not connected. You should connect it to the button somewhere.

Edit to add:
Did you look at the tutorials?
There are some that involve buttons.

Thank you so much for replying! I've managed to connect it up but now the screen is just showing black squares instead of the text that i've coded, am i making a really silly mistake?

Did you try adjusting your contrast POT? If it is turned up too high, the LCD will look like black squares.

Hi, yeah I've tried turning it up and down but still no luck!

I have built your circuit on breadboard (without the motor, but with the button wired up) and running your code.
If I press and hold the button for 2 seconds, it says: "Hello" and then "Press on again \ to calibrate"
If I then press the button again, it says: "press btn again".

So your display is connected correctly.

Until I press and hold the button for 2 seconds, the display is not initialised. It shows one line of solid blocks and one empty line.

Try and write a small program that only writes some text to the display and nothing else.

Also, read in this thread: " Display not showing anything" what Paul__B says about wiring up potentiometers to the contrast pin of these LCDs. If you actually use a 100kΩ pot, like in your fritzing picture, then your contrast adjustment will be very fiddly.

Thanks for trying that out - It's helpful to know I'm on the right track! I've managed to get some characters displaying on the screen but now the issue I'm having is that the screen only shows characters when my finger is pressing down on the button (as soon as I take my finger off it disappears)??

Jobi-Wan:
Try and write a small program that only writes some text to the display and nothing else.

Did you do this?

Leave your circuit as it is for now, and write a program (or use an example or tutorial) that only writes some text, and does not do anything else. This program will have nothing in loop().
If you then still only see the text while you press the button, that would be ... ... interesting.

Jobi-Wan:
Also, read [...] about wiring up potentiometers to the contrast pin of these LCDs.

Did you do this? Are you actually using a 100kΩ potentiometer?

Instead of connecting pin 3 of your display to the wiper of your potentiometer, try connecting it to ground with 220 or 1000 or 2000 Ohm resistance. See if any of those give you a nice readable display.