Fertiliser mixing station

Dependencies:   mbed

Revision:
1:a1f7cc753866
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/peristaltics.h	Fri Oct 04 22:15:50 2013 +0000
@@ -0,0 +1,47 @@
+
+class Peristaltics {
+    private :
+        vector<Pump *>pumps;
+
+    public:
+    
+    Peristaltics(int on_value) {
+        this->pumps.push_back(new Pump(p5, &led1, on_value));
+        this->pumps.push_back(new Pump(p6, &led2, on_value));
+        this->pumps.push_back(new Pump(p7, &led3, on_value));
+    }
+    
+    void nutrient_a(unsigned int ml) {
+led1 = 1;
+        this->pumps[0]->on(1.0 * ml);
+    }
+    
+    void nutrient_b(unsigned int ml) {
+led2 = 1;
+        this->pumps[1]->on(1.0 * ml);
+    }
+    
+    void pH(unsigned int ml) {
+led3 = 1;    
+        this->pumps[2]->on(1.0 * ml);
+    }
+    
+    void all_off() {
+        for(int p = 0; p < pumps.size(); p++)
+            this->pumps[p]->off();
+led1 = 0;
+led2 = 0;
+led3 = 0;            
+    }
+    
+    
+    ~Peristaltics() {
+        for(int p = 0; p < pumps.size(); p++)
+            delete this->pumps[p];
+
+led1 = 0;
+led2 = 0;
+led3 = 0;            
+            
+    }
+};
\ No newline at end of file