-
Notifications
You must be signed in to change notification settings - Fork 0
/
DiffPulse.ino
65 lines (53 loc) · 1.91 KB
/
DiffPulse.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
// DiffPulse tab / StellarisWheeStat sketch
// In anodic stripping voltammetry, the working electrode is initially held
// at a voltage negative of that where the analyte is reduced for a
// given plating time. The reduced analyte is precipitated onto the
// electrode and the amount on the electrode is analyzed by measuring
// current passed as the voltage is scanned positive through the potential
// at which the material is re-oxidized.
void diffPulse() {
///////// Stripping ////////////////////////////////////////////////
for (int dC = 0; dC <= nSteps; ++dC){
if (runState == true){
if (dInit < dFnl){
dSig = dInit + (dC*pwm_step); // calculate digital Signal value
}
else {
dSig = dInit - (dC*pwm_step);
}
PWMWrite(signal_pin,pwmRes,dSig,pwmClock);
digitalWrite(pulse_pin,HIGH);
delay(stepTime/2);
readVolts();
readCurrent(true);
digitalWrite(pulse_pin,LOW);
delay(stepTime/2);
readCurrent(true);
Serial.print(iMin);
Serial.print(",");
Serial.println(iMax);
//readStop(); // if GUI transmits '&', stop read
// Serial.println("");
if(Serial.available()>0) {
sRead = Serial.read();
if (sRead == '%') {
runState = false;
}
}
}
}
openCircuit(); // go to open circuit
}
void cleanDepos(){
//////Electrode cleaning ////////////////
digitalWrite(pulse_pin,LOW); // set pulse pin to low
PWMWrite(signal_pin,pwmRes,dFnl,pwmClock); // electrode cleaning voltage
digitalWrite(stir_pin,HIGH);
delay(2000);
////////// Preconcentration /////////////////////////////////////////////////
PWMWrite(signal_pin,pwmRes,dInit,pwmClock); // set signal voltage to initial value
delay(delay1*1000);
/////// quiet solution //////////////////////////////////////////////////////
digitalWrite(stir_pin,LOW);
delay(500);
}