Arduino with Adafruit LCD and backpack Help

I am trying to have 3 buttons on my breadboard that correspond to 1. turn on, 2. select mode 1,2,3 , 3. select a temperature 70, 80, 90.
I have been able to get step 1 working correctly but am struggling now trying to add the LCD and code for it. Please advise!

#include <Bounce2.h>
#include <Wire.h>
#include <Adafruit_LiquidCrystal.h>
Adafruit_LiquidCrystal lcd(0); 



// I/O Definition
// const int THERMISTOR_PIN = A1;    //Do we need a thermistor???

const int HEAT_PIN = 9; 

const int START_PIN = 8;
const int TEMP_PIN = ;
const int MOLD_PIN = ;

//State variables
bool isRunning = false;
bool previousCommand = false; 

//Global vars
const unsigned long MAX_RUN_TIME = 350000; // (90000ms) 350 seconds = amount of time for heater to reach 100 deg C; what max temp do we want?
unsigned long runStart = 0;

//Debouncer setup
Bounce debouncer = Bounce();

void setup() {
  // put your setup code here, to run once:
  pinMode(HEAT_PIN, OUTPUT);
  pinMode(START_PIN, INPUT);

  debouncer.attach(START_PIN, INPUT);
  debouncer.interval(50);

  Serial.begin(9600);
  Serial.println("Setup Complete");
}

void loop() {
  // put your main code here, to run repeatedly:

  debouncer.update();

  if(debouncer.fell() ){
    Serial.println("Button pressed");
    button_press();
  }

  if (isRunning) {
    if ((millis() - runStart) > MAX_RUN_TIME){
      stop_cycle();
    }
  }
  delay(50);
}

////////////////////////////////////////////////////////
void button_press(){
  if (isRunning){
    stop_cycle();
  }

   else {
    isRunning = true;
    digitalWrite(HEAT_PIN, HIGH);
    runStart = millis();
  }
}

void stop_cycle(){
  Serial.println("Cycle Stopped");
  digitalWrite(HEAT_PIN, LOW);
  isRunning = false;
}

//////////////////////////////////////////////////////////
int Pin1 = 4;
int Pin2 = 5;
int Pin3 = 6;
int Pin4 = 7;


void setup() {
  lcd.begin(16,2);
  pinMode(Pin1, OUTPUT);
  pinMode(Pin2, OUTPUT);
  pinMode(Pin3, OUTPUT);
  pinMode(Pin4, OUTPUT);
}
void loop () {
}

Hello m11s

Run a pure LCD turorial to gain the knowledge.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.