Paul,
As I say the main sketch does nothing with my class yet as it doesn't compile, but here it is;
/*
LMS10000 EECS - LMS 10000 Engine Electronic Contol System
Copyright (c) 2012 Mark Batchelour. All right reserved.
*/
// Includes ------------------------------------------------------------------------------------------------------
#include "LMS10000Constants.h"
#include <SerialCommand.h>
#include <LCD5110.h>
#include "DHT22TempHumidity.h"
// Locals ------------------------------------------------------------------------------------------------------
SerialCommand SCmd; // The demo SerialCommand object
boolean SerialOutputEnabled = true;
boolean UseAuthorised = false;
String StatusMessage = "";
String ParamMessage = "";
// Setup ------------------------------------------------------------------------------------------------------
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
LcdInitialise();
LcdClear();
gotoXY(LCDLeft,LCDBannerLine);
LcdString(LCDbannerString);
// Setup callbacks for SerialCommand commands
SCmd.addCommand(ControlPassword,PasswordGiven); // Turn on serial output
SCmd.addCommand(EngineStopCmdshort,StopEngine); // Turns engine off
SCmd.addCommand(EngineStopCmd,StopEngine); // Turns engine off
SCmd.addCommand(MonitorOffCmd,MonitoringOff); // Turns monitoring off
SCmd.addCommand(MonitorOnCmd,MonitoringOn); // Turns monitoring off
SCmd.addDefaultHandler(unrecognized); // Handler for command that isn't matched (says "What?")
Serial.println(RemoteReadyPrompt);
}
// Security Functions ------------------------------------------------------------------------------------------
void PasswordGiven()
{
UseAuthorised = true;
Serial.println(RemoteAuthorisedMsg);
Serial.println(RemoteReadyPrompt);
StatusMessage += RemoteMonEnableMsg;
}
void unrecognized()
{
Serial.println(RemoteBadCmdMsg);
Serial.println(RemoteReadyPrompt);
}
void MonitoringOn()
{
if (UseAuthorised)
{
SerialOutputEnabled = true;
StatusMessage = RemoteMonEnableMsg;
Serial.println(RemoteMonEnableMsg);
Serial.println(RemoteReadyPrompt);
}
else
{
Serial.println(RemoteNotAuthMsg);
Serial.println(RemoteReadyPrompt);
}
}
void MonitoringOff()
{
if (UseAuthorised)
{
SerialOutputEnabled = false;
StatusMessage += RemoteMonDisableMsg;
Serial.println(RemoteMonDisableMsg);
Serial.println(RemoteReadyPrompt);
}
else
{
Serial.println(RemoteNotAuthMsg);
Serial.println(RemoteReadyPrompt);
}
}
// Engine control ----------------------------------------------------------------------------------------------------------------
void StopEngine()
{
if (UseAuthorised)
{
// stop the engine
Serial.println(RemoteEngStopMsg);
StatusMessage += RemoteEngStopMsg;
Serial.println(RemoteReadyPrompt);
}
else
{
Serial.println(RemoteNotAuthMsg);
Serial.println(RemoteReadyPrompt);
}
}
// main ----------------------------------------------------------------------------------------------------
void loop() {
//pause for a while
delay(UpdateInterval);
// read serial commands
SCmd.readSerial();
// read sensors
// Dispay parameters
// Evaluate warnings
// Raise alarms
if (SerialOutputEnabled == true)
{
}
gotoXY(LCDLeft,LCDStatusLine);
Scroll(StatusMessage);
gotoXY(LCDLeft,LCDParamLine);
Scroll(ParamMessage);
}
and here is the body of the DHT22TempHumidity class;
/*
DHT22TempHumidity - basic template for LMS 10000 sensor
Copyright (c) 2012 Mark Batchelour. All right reserved.
LMS 10000 reCreation project. www.LMS10000.org
*/
// ensure this library description is only included once
#ifndef DHT22TempHumidity_h
#define DHT22TempHumidity_h
// include types & constants of Wiring core API
#include "Arduino.h"
#include <dht.h>
// library interface description
class DHT22TempHumidity
{
// user-accessible "public" interface
public:
DHT22TempHumidity(int);
float GetValue(void);
float ReadSensor(void);
void DisplaySerial(void);
void DisplayLcd(void);
dht SensorDHT22;
// library-accessible "private" interface
private:
float value;
};
#endif