Hello,
I’m a beginner at coding and decided to make a timer from YouTube. I was able to wire everything to the breadboard and LCD, but the display only turns on and doesn’t display text or boxes. I hooked up a potentiometer and it doesn’t help the contrast on the display. The potentiometer does work as I used it in another project. The blue button is supposed to start the timer and the black button is supposed to stop the timer. I’ll attach the code, written out pin connection from the video and the setup I made. I’m not sure why the display isn’t showing text, so I’d appreciate any suggestions you have.
#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
unsigned long time; //for whole numbers w/o negatives
void setup()
{
lcd.begin(16, 2);
lcd.clear();
Serial.begin(9600);
pinMode(8, INPUT); //set pin to input
digitalWrite(8, HIGH); //turn on pullup resistors
pinMode(9, INPUT);
digitalWrite(9, HIGH);
pinMode(10, INPUT);
digitalWrite(10, HIGH);
}
double i = 0; //double=float - defines numeric variables
double a = millis();
double c ;
void loop()
{
lcd.clear();
lcd.print("Ready to Wrestle?");
lcd.setCursor(0, 1);
lcd.print("Press to start:)");
delay(100);
if (digitalRead(8) == LOW)
{
lcd.clear();
a = millis();
while (digitalRead(9) == HIGH)
{
c = millis();
i = (c - a) / 1000;
lcd.print(i);
lcd.setCursor(8, 0);
lcd.print("Seconds");
lcd.setCursor(0, 0);
Serial.println(c); //Prints value
Serial.println(a);
Serial.println(i);
Serial.println("...");
delay(100);
}
if (digitalRead(9) == LOW)
{
while (digitalRead(8) == HIGH)
{
lcd.setCursor(0, 0);
lcd.print(i);
lcd.setCursor(8, 0);
lcd.print("Seconds");
lcd.setCursor(0, 0);
delay(100);
}
}
}
}