Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed DRV88255 TextLCD Ping mbed-rtos
AlarmController.h
- Committer:
- sbouber1
- Date:
- 2016-06-17
- Revision:
- 52:eaddbde192f1
- Parent:
- 48:d7053e51b30a
File content as of revision 52:eaddbde192f1:
#ifndef __ALARMCONTROLLER_H__ #define __ALARMCONTROLLER_H__ #include "mbed.h" #include "SensorController.h" #include "PIDController.h" #include "testing.h" /** The number of iterations before the AlarmController registers unsafe values */ #define STARTUP_ITERATIONS 10 /** The AlarmController monitors the Temperature/Salinity/Proximity sensors and registers unsafe values. * After a specified amount of time an alarm is raised by means of a buzzer. */ class AlarmController : public Controller { public: /** Contructs a new AlarmController which monitors the given Temperature/Salinity/Proximity controllers. */ AlarmController(bool threaded, int interval_ms, SensorController *temp, SensorController *salt, SensorController *proximity) : Controller(threaded, interval_ms) { this->temp = temp; this->salt = salt; this->proximity = proximity; this->error = false; this->tempiscrit = false; this->saltiscrit = false; this->overflowiscrit = false; } /** Overrides update() in the Controller class */ virtual void update(); /** Overrides get_name() in the Controller class */ virtual std::string get_name(); /** Return \a true if there is an error condition and the alarm was raised. */ bool is_error(); /** Returns a message describing the last error */ char *get_error_message(); private: SensorController *temp; SensorController *salt; SensorController *proximity; bool error; char *error_msg; /** Activates the buzzer */ void buzzOnce(); /** Activates an alarm for the temperature controller */ void raiseAlarmTemp(bool); /** Activates an alarm for the salinity controller */ void raiseAlarmSalt(bool); /** Activates an alarm for the proximity controller */ void raiseAlarmOverFlow(bool); bool tempiscrit; bool saltiscrit; bool overflowiscrit; Timer temptimer; Timer salttimer; Timer overflowtimer; }; #endif