Hi.
I'm working on a system for growing bacteria with periodic addition of new growth medium and removal of used medium. Every four hours, a number of milliliters are pumped in, and the same amount removed from the vials with peristaltic pumps.
Once a day we want to take out a sample for analysis, and at the same time keep the volume konstant in the growth vials. I would like to be able to press a button that would pause the pump that removes medium from the vials for one cycle when we do the sampling.
I don't really know how to go about doing this, so any advice would be helpful.
The project is based on this one: MiCoMo
```cpp
//Code for Arduino Mega1
//This code
//2. Send voltage to gas sparger.
//3. Send voltage to pumps for liquid transfer.
//The following time stamps are all in seconds
//Start is earlier for inlet than outlet to compensate for evaporation
//For this, we just need food to colon and colon to waste
//Feed every 4 hours. Transfers for all reactors will happen at exact same time
//Inputting ~4.5ml of content and outputing ~4ml of content
//This ensures an overall ~30 hours retention time
#define TimeStamp1 14000//Food to start inputting liquid into reactors
#define TimeStamp2 14040 //Food to start removing liquid from reactors
#define TimeStamp3 14280 //Time to stop both transfers
#define TimeStamp4 14400 //Time to reset the system
int i;
int k;
int j;//Placeholder counter
int inputpin = 3; //pin for multichannel pump of adding liquid into reactors
int outputpin = 2;//pin for multichannel pump of removing liquid from reactors
//only 1 pin used because of using 6-channel pump
const int spargerpin = 10;
int timer = 0;//Timer for liquid transfer
int tspa = 0; // Timer for sparging gas
void setup() {
Serial.begin(9600);
pinMode (inputpin,OUTPUT);
pinMode (outputpin,OUTPUT);
pinMode (spargerpin,OUTPUT);
}
void loop() {
//Now, check if we need liquid transfer
if ((timer > TimeStamp1) && (timer < TimeStamp3)){
digitalWrite(inputpin,HIGH);
}
else {
digitalWrite(inputpin,LOW);
}
if ((timer > TimeStamp2) && (timer < TimeStamp3)){
digitalWrite(outputpin,HIGH);
}
else {
digitalWrite(outputpin,LOW);
}
if (timer > TimeStamp4){
timer = 0;
}
timer += 1;
//Now, handles the gas sparging
if (tspa > 5){//reset timer if it exceeds 5 secs
tspa = 0;
}
tspa += 1;
if (tspa > 3 && tspa < 5){//At the fifth second, sparge
digitalWrite(spargerpin,HIGH);
}
else {
digitalWrite(spargerpin,LOW);
}
//After everything, wait for 1 sec
delay(1000);
Serial.println(timer);
}