Ardruino LCD set timed relay

I am working on a little project where i want to use a LCD displayed timer you can increase by 10 sec when you press a button.

It’s supost to work like this:

Press button 3x —> LCD displays 30sec —> press button timer start —> Timer counts down on LCD —> when timer = 0 —> switch relay.

I currently use this bit of code to add 10 sec to my timer but i want to change the value of the timer to increase 10000 at one time and not by repeating the same code 10000 times each time i want to add 10 sec to my timer.

if( b_Timerup==HIGH )
       for(int i = 0; i<10000; i++) {
         Timer ++;

I haven’t tested the code yet and i don’t have a 10k linear potentiometer for the LCD Display does somewane know if i can use a resistor instead?

My full this far code:

#include <LiquidCrystal.h>

const int b_Timerup = 22;          //Set time up 10 sec
const int b_Timerreset = 23;       //Reset timer
const int b_Timerstart = 24;       //Starts timer
const int b_Timerstop = 25;        //Stops Timer
const int Relay = 26;              //Switch Relay
const int LED_Timer = 40;          //Timer on LED

const int d7 = 2;
const int d6 = 3;
const int d5 = 4;
const int d4 = 5;
const int en = 11;
const int rs = 12;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

int Timer = 0;                     //Timer Amount

void setup() {
 pinMode (b_Timerup,INPUT);
 pinMode (b_Timerreset,INPUT);
 pinMode (b_Timerstop,INPUT);
 pinMode (Relay,OUTPUT);
 pinMode (LED_Timer,OUTPUT);
 lcd.begin(16, 2);
 lcd.print("Welcome Dovah");

void loop() {
 if( b_Timerup==HIGH )
       for(int i = 0; i<10000; i++) {
         Timer ++;
 if( b_Timerreset==HIGH )
       digitalWrite(Relay, LOW); 
       Timer = 0;
       //LCD display "Timer reset"
 if( b_Timerstart==HIGH )
       digitalWrite(LED_Timer, HIGH);
       //LCD display "count down in sec"
       digitalWrite(Relay, HIGH);

Timer += 10000.
Will the trim pot be used for setting the contrast? Then buy a pot. You would need lots of resistors and lots of work to make it work.

Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom... :slight_smile:

I change the code to the correct format thank you Tom. :slight_smile:

Thank you Railroader i edited my code still need to test to see if it worked but it compiles. I indeed need a potmeter to change the contrast i can't see anything except white boxes (Not shown in my photo) when i connect the "VO" cable to my GND.

I scraped my LCD from my 3D printer that broke down about a year ago. do you think that it can give any problems?

If you want i can make a drawing of the circuit if you would like but, most of the wiring speaks for it self if you read my code.