I stripped out all the loops etc to find the problem.


 #define C+ 0  //digital pin for cap
 #define C- 1  //digital pin for cap
 #define ec 2  //digital pin for cap

void setup() {
  // put your setup code here, to run once:


void loop() {
  // put your main code here, to run repeatedly:
pinMode(ec,INPUT);    // High impedence
digitalWrite(C+, HIGH);                 //1
digitalWrite(C-, LOW);  // Wait for capacitor to charge.

pinMode(ec, OUTPUT);                  //2
digitalWrite(ec, LOW);  

// Measure discharge time here

pinMode(ec,INPUT);    // High impedence
pinMode(C+, OUTPUT);
digitalWrite(C+, HIGH);                 //4  Discharge capacitor
digitalWrite(C-, HIGH);

digitalWrite(C+, LOW);                                  //5 Recharge cap wih reverse polarity  

pinMode(C+, INPUT);
pinMode(ec, OUTPUT);                  //6 
digitalWrite(ec, HIGH);

//Measure discharge time here

pinMode(ec, INPUT);
digitalWrite(C-, LOW);
pinMode(C+, OUTPUT);
digitalWrite(C+, LOW);

//Temp compensation here


I get this on the last line.

expected primary-expression before ',' token

What am i doing wrong ? I am a fairly inexperienced with C.

You can't use + and - symbols in a variable name. The reason is obvious when you consider an expression like va-vb+vc.

Change your #defines. The compiler thinks the '+' and '-' are operators and not part of the identifier.

#define CPLUS 0    //digital pin for cap
#define CMINUS 1   //digital pin for cap
#define ec 2       //digital pin for cap

Edit: Make sure your comments convey accurate information

Thank you both