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
00001 #ifndef __PIDCONTROLLER_H__ 00002 #define __PIDCONTROLLER_H__ 00003 00004 #include <iostream> 00005 00006 #include "mbed.h" 00007 #include "DRV8825.h" 00008 #include "stdio.h" 00009 #include "SensorController.h" 00010 #include "settings.h" 00011 00012 00013 #define MAX_SPEED 8000 00014 #define MICROSTEPS_PER_STEP 16 00015 00016 #define LEFT 1 00017 #define RIGHT 0 00018 00019 00020 class PIDController : public Controller { 00021 00022 00023 public: 00024 PIDController(bool threaded, int interval_ms, SensorController *temp, SensorController *salt, SensorController *proximity) 00025 : Controller(threaded, interval_ms) { 00026 this->temp = temp; 00027 this->salt = salt; 00028 this->proximity = proximity; 00029 this->pumping = false; 00030 this->heating = false; 00031 } 00032 00033 ~PIDController(); 00034 00035 virtual void update(); 00036 00037 virtual std::string getName(); 00038 00039 bool isHeating(); 00040 00041 bool isPumping(); 00042 00043 void doTestingStuff(int ml); 00044 00045 private: 00046 SensorController *temp; 00047 SensorController *salt; 00048 SensorController *proximity; 00049 00050 bool heating; 00051 bool pumping; 00052 00053 void pumpSaltWater(int ml); 00054 00055 void pumpFreshWater(int ml); 00056 00057 void pumpWater(DRV8825 *mtr, int ml); 00058 00059 float getMlSaltyWater(float, float); 00060 00061 float getMlFreshWater(float, float); 00062 00063 float getSaltInGrams(); 00064 00065 void setHeating(bool enabled); 00066 }; 00067 00068 00069 #endif
Generated on Tue Jul 12 2022 18:59:29 by
1.7.2