Thanks for the welcome. Ok, here goes:
Sandbox_1.ino
#include "DHT.h"
#include "Globals.h"
#include "GoB_Sensor.h"
//#include "GoB_Sensor_TempHumid.h"
//GoB_Sensor_TempHumid TempHumid_G("TempHumid Sensor", SENSOR_1, LOGGING_VERBOSITY, REPORTING_VERBOSITY, TESTING_INTENSITY);
GoB_Sensor* p_Sensor_G;
GoB_Sensor mySensor;
p_Sensor_G = &mySensor;
//GoB_Sensor sensorArray[0] = &Sensor_G;
// For the Adafruit shield, these are the default.
#define TFT_DC 9
#define TFT_CS 10
// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("Karaerin v1.1 Boot Sequence");
tft.begin();
}
void loop() {
// put your main code here, to run repeatedly:
String sensorName = "Default";
delay(1000);
//sensorName = TempHumid_G.getName();
sensorName = p_Sensor_G->getName();
tft.print(F("Sensor Name: ")); tft.println(sensorName);
delay(5000);
}
GoB_Sensor.h:
#ifndef _GOBSENSOR_H_
#define _GOBSENSOR_H_
#include "Globals.h"
#include "Arduino.h"
class GoB_Sensor {
private:
String myName = "Generic Sensor";
uint8_t myID = 0;
uint8_t myLoggingVerbosity = 0;
uint8_t myReportingVerbosity = 0;
uint8_t myTestingIntensity = 0;
public:
String getName();
uint8_t setName(String nameString); //Returns SUCCESS on success
uint8_t setID(uint8_t sensorID); //Returns SUCCESS on success
uint8_t getID ();
uint8_t setLoggingVerbosity(uint8_t loggingVerbosity); //Returns SUCCESS on success
uint8_t getLoggingVerbosity();
uint8_t setReportingVerbosity(uint8_t reportingVerbosity); //Returns SUCCESS on success
uint8_t getReportingVerbosity();
uint8_t setTestingIntensity(uint8_t TestingLevel); //Returns SUCCESS on success
uint8_t getTestingIntensity();
virtual uint8_t m_SetupSensor(DHT &r_MySensor);
virtual float m_ReadSensor(int mySensor, int tempMode);
GoB_Sensor();
GoB_Sensor(uint8_t sensorID, uint8_t verbosityLevel, uint8_t reportingLevel, uint8_t testingLevel);
//~GoB_Sensor(); //TO-DO: Figure out how to make =0 w/o being Abstract Class
};
#endif
GoB_Sensor.cpp:
#include "GoB_Sensor.h"
//#include "GoB_Sensor_TempHumid.h"
uint8_t m_SetupSensor(DHT &r_MySensor)
{
//Empty
}
float m_ReadSensor(int mySensor, int tempMode)
{
//Empty
}
String GoB_Sensor::getName() {
return myName;
}
uint8_t GoB_Sensor::setName(String nameString) {
myName = nameString;
return SUCCESS;
}
uint8_t GoB_Sensor::setID(uint8_t sensorID) {
myID = sensorID;
return SUCCESS;
}
uint8_t GoB_Sensor::getID () {
return myID;
}
uint8_t GoB_Sensor::setLoggingVerbosity(uint8_t loggingVerbosity) {
myLoggingVerbosity = loggingVerbosity;
return SUCCESS;
}
uint8_t GoB_Sensor::getLoggingVerbosity() {
return myLoggingVerbosity;
}
uint8_t GoB_Sensor::setReportingVerbosity(uint8_t reportingVerbosity) {
myReportingVerbosity = reportingVerbosity;
return SUCCESS;
}
uint8_t GoB_Sensor::getReportingVerbosity() {
return myReportingVerbosity;
}
uint8_t GoB_Sensor::setTestingIntensity(uint8_t testingLevel) {
myTestingIntensity = testingLevel;
return SUCCESS;
}
uint8_t GoB_Sensor::getTestingIntensity() {
return myTestingIntensity;
}
GoB_Sensor::GoB_Sensor() {
myName = "Generic Sensor";
myID = 0;
myLoggingVerbosity = 0;
myReportingVerbosity = 0;
myTestingIntensity = 0;
}
GoB_Sensor::GoB_Sensor(uint8_t sensorID, uint8_t loggingLevel, uint8_t reportingLevel, uint8_t testingLevel) {
myName = "Generic Parameterized Sensor 1";
myID = sensorID;
myLoggingVerbosity = loggingLevel;
myReportingVerbosity = reportingLevel;
myTestingIntensity = testingLevel;
}
/* GoB_Sensor::~GoB_Sensor()
{
//empty
}
*/
Globals.h:
#ifndef _GLOBALS_H_
#ifndef _GLOBALS_H_
#define _GLOBALS_H_
#include "DHT.h" //All sensor definitions must be global.
#define LOGGED_SAMPLE_SIZE 5
// GoB defines
#define SUCCESS 1
#define FAILURE 0
#define FAHRENHEIT 1
#define CELSIUS 0
//[SNIP--misc #defines]
#endif