expected primary-expression before ',' token

Hi everybody,

I have previously searched similar posts, and checked ’ ; ’ but I cannot find my error :confused: .
Any help would be truly thanked.

#define POT 0

//First I define the pins for the RGB
#define RGB_VERDE 11
#define RGB_AZUL 10
#define RGB_ROJO

int medida_pot, valor_pwm, valor_ajustado;
//To change later analogic to PWM and the to 0-100

void setup()
{
pinMode(RGB_VERDE, OUTPUT);
pinMode(RGB_AZUL, OUTPUT);
pinMode(RGB_ROJO, OUTPUT);
Serial.begin(9600);
}

void loop() 
{
  medida_pot = analogRead(POT);

  // analogic to PWM
  valor_pwm = map(medida_pot, 0, 1023, 0, 255);

  //from PWM 0, 255 to 0, 100 which is easier to read
  valor_ajustado = map(valor_pwm, 0, 255, 0, 100);

  //This is what appears on serial monitor
  Serial.print("La medida del pot es: ");
  Serial.println(valor_ajustado);
  delay(100);

  //analogWrite(RGB, valor_ajustado); This is just for testing

  //Conditions for switching on the different colours on the RGB

  if (valor_ajustado > 70) {
    digitalWrite(RGB_VERDE, HIGH);
    digitalWrite(RGB_AZUL, LOW);
    digitalWrite(RGB_ROJO, LOW);
  }
  else if (valor_ajustado < 30) {
    digitalWrite(RGB_VERDE, LOW);
    digitalWrite(RGB_AZUL, HIGH);
    digitalWrite(RGB_ROJO, LOW);
    }
  else {
   digitalWrite(RGB_VERDE, LOW);
   digitalWrite(RGB_AZUL, LOW);
   digitalWrite(RGB_ROJO, HIGH);
  }
  }
}
pinMode(RGB_ROJO, OUTPUT);

When the compiler sees this line, the preprocessor has replaced the value associated with the name, resulting in:

pinMode(, OUTPUT);

And, of course that is an error.

Thank you so much, I have read my code over 20 times, but I was unable to see that simply thing.
I'm getting older :slight_smile:

When looking for errors, it's always good to look for inconsistencies.

//First I define the pins for the RGB
#define RGB_VERDE 11
#define RGB_AZUL 10
#define RGB_ROJO

The first two names have values. The third does not. That's an inconsistency.

Thanks Paul, the thing is that I did it reviewing each line, and I use notepad++ so it was easier, but I didn't see it, ADHD doesn't work always very good with coding.

daveprofe:
Thanks Paul, the thing is that I did it reviewing each line, and I use notepad++ so it was easier, but I didn't see it, ADHD doesn't work always very good with coding.

Sorry. What were we talking about?

ADHA - Attention deficit hyperactivity disorder?

Thank you so much, I have read my code over 20 times, but I was unable to see that simply thing.

Most people find that sort of thing hard to spot, and the compiler error messages can be hard to understand.
The main thing is you tried to solve it yourself at lot of folk don't. In most cases compilers are pretty good at pinning a fault down to a specific line. If you cannot see the fault in that line try commenting the section of code out just to confirm you know where the problem is and then try writing the offending line in a different way. I find that sometimes helps me see the fault.