I'm trying to Initialize an instance of a new Class (object) inside a Class Function (Setup) and have the new Object available to the other Functions, having problem with sharing (scope) the new objects between Functions..
/*
* Class_LCD_Display.cpp
*
* Created: 9/13/2014 8:46:49 AM
* Author: Byron
*/
#include <Arduino.h>
#include <ReadTimeData.h>
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#include "Class_LCD_Display.h"
// This works but the address is hard coded inside this Class
//--> LiquidCrystal_I2C lcd(0x26,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
//Constructor
Class_LCD_Display::Class_LCD_Display()
{
}//Class_LCD_Display
//Destructor
Class_LCD_Display::~Class_LCD_Display()
{
}//~Class_LCD_Display
//Public--------------------
void Class_LCD_Display::LCD_Setup(int I2C_ADDR){
// This works only for this function/member, how do I share this "instance of the Class" to the other funtions?
//--> LiquidCrystal_I2C lcd( I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
//Initialize the lcd
lcd.begin (20,4);
//Switch on the backlight
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(LED_ON);
//Clear the display
LCD_Clr();
//Backlight ON if under program control
lcd.backlight();
}//End LCD_Setup
// Called from .ino
void Class_LCD_Display::LCD_Clr(){
//Clear the display
lcd.clear();
delay(1000);
lcd.home();
}//End LCD_Clr
//Called form .ino
void Class_LCD_Display::LCD_Display(int X_Pos, int X_Row, String LCD_string){
String Blk_ln = " ";
//
lcd.setCursor(X_Pos,X_Row);
lcd.print(Blk_ln);
lcd.setCursor(X_Pos,X_Row);
lcd.print(LCD_string);
}//End LCD_Display