class LCDUPDATE{
public:
LCDUPDATE(int status1, int status2, int status3, int status4, int hstatus, int mstatus, int bstatus)
LCDUPDATE is a constructor because it is named LCDUPDATE and it returns nothing
calling a constructor in loop is nonsense, particularly because it is destroyed immediately when loop() ends.
Plus, you are calling lcd.this() and lcd.that() inside the constructor, which has a scope issue.
try like this:
header:
#ifndef LCD_h
#define LCD_h
#include <LiquidCrystal.h>
int status1; // LCD STATUS DISPLAYS 1 = BOOTING 2 = READY 3 = INDEXING 4 = FAILURE 5 = PASS
int status2;
int status3;
int status4;
int status1old;
int status2old;
int status3old;
int status4old;
int hstatus; // header
int mstatus; // Middle status 1= Startup 2=Ready 3=Waiting for STN 4 index stg 1
int bstatus; // Bottom status
int hstatusold;
int mstatusold;
int bstatusold;
int feedback; // lcd feedback print
int feedbackold;
class MyLcdClass{
public:
myLcdClass(){}; // c'tor
void begin(){
lcd = new LiquidCrystal(12, 11, 5, 4, 3, 2);
lcd->begin(20,4);
};
update(int status1, int status2, int status3, int status4, int hstatus, int mstatus, int bstatus)
{
if (hstatus != hstatusold)
{
if (hstatus == 1)
{
lcd->setCursor(0, 0);
lcd->print(" ");
lcd->setCursor(0, 0);
lcd->print(" Boot Complete ");
}
hstatusold = hstatus;
delay(100);
lcd->setCursor(2, 2);
lcd->print(hstatus);
lcd->setCursor(3, 3);
lcd->print(hstatusold);
}
}
private:
LiquidCrystal* lcd;
};
#endif
and .ino
//include required libraries
#include <SoftwareSerial.h>
#include <LiquidCrystal.h>
#include <Stepper.h>
#include "LCDU.h"
//===CONSTANTS and variables (buttons and pins)
const int buttonPin = 9; // start button
const int estopbutton = 8; //estop button
const int indexswitch = 7; //table index switch
const int indexmotor = 6; //table stepper motor
const int indexdir = 10; //table stepper direction pin
//===== LED PINS
const int stn1good = 50; //50
const int stn1bad = 52; //52
const int stn2good = 46; //46
const int stn2bad = 48; //48
//===== STEPPER PINS
const int stepsPerRevolution = 200;
Stepper myStepper(stepsPerRevolution, 42, 40, 38, 36);
int stepspeed = 10;
//ALSO SEE myStepper.setSpeed(100);
//==== LCD Variable
int LCDtest = 0;
int printtest;
MyLcdClass myObject;
void setup()
{
myObject.begin();
}
void loop()
{
myObject.update(1, 1, 1, 1, 1, 1, 1);
delay(1000);
}
compiles but not tested...