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.
flow_controlled.h
00001 00002 class Flow_Controlled { 00003 private : 00004 vector<Pump *>pumps; 00005 DigitalOut *enable; 00006 DigitalIn *flow; 00007 00008 public: 00009 00010 Flow_Controlled(int on_value) { 00011 this->enable = new DigitalOut(p17); 00012 this->pumps.push_back(new Pump(p18, &led1, on_value)); 00013 this->pumps.push_back(new Pump(p19, &led2, on_value)); 00014 this->flow = new DigitalIn(p20); 00015 } 00016 00017 void raw_water(unsigned int litres) { 00018 this->pumps[0]->on(0.7 * litres); 00019 } 00020 00021 void recycled_water(unsigned int litres) { 00022 this->pumps[1]->on(0.7 * litres); 00023 } 00024 00025 void all_off() { 00026 for(int p = 0; p < pumps.size(); p++) 00027 this->pumps[p]->off(); 00028 this->enable->write(0); 00029 } 00030 00031 ~Flow_Controlled() { 00032 for(int p = 0; p < pumps.size(); p++) 00033 delete this->pumps[p]; 00034 delete this->enable; 00035 delete this->flow; 00036 00037 } 00038 };
Generated on Tue Jul 19 2022 15:52:20 by
1.7.2