-
Notifications
You must be signed in to change notification settings - Fork 0
/
TitrationMonitor.ino
111 lines (68 loc) · 2.08 KB
/
TitrationMonitor.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
Titration Monitor.ino
Program for monitoring progress of volumetric titrations using Arduino Uno.
By: Steven King and Freddie Thompson, 2018
University of Tennessee, CHEM 459
Dr. Frank Vogt, Instructor
*/
#define ledControlPin 4
#define laserControlPin 2
#define laserReadPin A1
#define ledReadPin 3
#define buttonAPin 7
#define buttonBPin 8
// Will need 3-4 more digital pins if using programmable operational amplifier
int dropCount = 0;
float volume_initial = 0;
float volume_final = 0;
void setup(){
Serial.begin(9600);
Serial.println("INITIALIZING...");
pinMode(ledControlPin,OUTPUT);
pinMode(laserControlPin,OUTPUT);
pinMode(laserReadPin,INPUT);
pinMode(ledReadPin,INPUT);
digitalWrite(ledControlPin,LOW);
digitalWrite(laserControlPin,LOW);
Serial.println("Calibrate dark current, place barrier between laser and associated sensor.");
Serial.println("Press button 2 to continue.");
digitalWrite(laserControlPin,HIGH);
digitalWrite(ledControlPin,HIGH);
while(digitalRead(buttonBPin)==LOW){}
float absDark = absorbanceRead();
delay(250);
Serial.println("Calibrate P_0, remove barrier between laser and associated sensor.");
Serial.println("Press button 2 to continue");
while(digitalRead(buttonBPin)==LOW){}
float absMax = absorbanceRead();
delay(250);
Serial.println("Calibration complete!");
delay(1000);
/*
Serial.println("Enter inital volume from buret in serial input...");
while(Serial.available()==0){}
volume_intial = Serial.read();
*/
Serial.println("Press button 1 to begin titration.");
while(digitalRead(buttonAPin)==LOW){}
Serial.println("Starting titration, press button 2 to end.");
}
void loop(){
while(digitalRead(buttonBPin==LOW)){
if(digitalRead(ledReadPin)==HIGH){
dropCount++;
float absorbance = absorbanceRead();
Serial.print(dropCount);
Serial.print(" : ");
Serial.println(absorbance);
}
}
Serial.println("Titration complete!");
delay(1000);
/*
Serial.println("Enter final volume from buret in serial input.");
while(Serial.available()==0){}
volume_final = Serial.read();
*/
while(1){};
}