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
PIDController.h
- Committer:
- sbouber1
- Date:
- 2016-06-19
- Revision:
- 57:8dc3192ff150
- Parent:
- 46:7e4c1f2ab76c
- Child:
- 65:b277b4067d4a
File content as of revision 57:8dc3192ff150:
#ifndef __PIDCONTROLLER_H__
#define __PIDCONTROLLER_H__
#include "mbed.h"
#include "DRV8825.h"
#include "stdio.h"
#include "SensorController.h"
#include "settings.h"
#define MAX_SPEED 8000
#define MICROSTEPS_PER_STEP 16
#define LEFT 1
#define RIGHT 0
class PIDController : public Controller {
public:
PIDController(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->pumping = false;
this->heating = false;
}
virtual void update();
virtual std::string getName();
bool isHeating();
bool isPumping();
void doTestingStuff(int ml);
private:
SensorController *temp;
SensorController *salt;
SensorController *proximity;
bool heating;
bool pumping;
void pumpSaltWater(int ml);
void pumpFreshWater(int ml);
void pumpWater(DRV8825 *mtr, int ml);
float getMlSaltyWater(float, float);
float getMlFreshWater(float, float);
float getSaltInGrams();
void setHeating(bool enabled);
};
#endif