Matt Lesslaw / Mbed 2 deprecated MagicMixer

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers peristaltics.h Source File

peristaltics.h

00001 
00002 class Peristaltics {
00003     private :
00004         vector<Pump *>pumps;
00005 
00006     public:
00007     
00008     Peristaltics(int on_value) {
00009         this->pumps.push_back(new Pump(p5, &led1, on_value));
00010         this->pumps.push_back(new Pump(p6, &led2, on_value));
00011         this->pumps.push_back(new Pump(p7, &led3, on_value));
00012     }
00013     
00014     void nutrient_a(unsigned int ml) {
00015 led1 = 1;
00016         this->pumps[0]->on(1.0 * ml);
00017     }
00018     
00019     void nutrient_b(unsigned int ml) {
00020 led2 = 1;
00021         this->pumps[1]->on(1.0 * ml);
00022     }
00023     
00024     void pH(unsigned int ml) {
00025 led3 = 1;    
00026         this->pumps[2]->on(1.0 * ml);
00027     }
00028     
00029     void all_off() {
00030         for(int p = 0; p < pumps.size(); p++)
00031             this->pumps[p]->off();
00032 led1 = 0;
00033 led2 = 0;
00034 led3 = 0;            
00035     }
00036     
00037     
00038     ~Peristaltics() {
00039         for(int p = 0; p < pumps.size(); p++)
00040             delete this->pumps[p];
00041 
00042 led1 = 0;
00043 led2 = 0;
00044 led3 = 0;            
00045             
00046     }
00047 };