Go Down

Topic: Error de compilación ISO C++ forbids comparison between pointer (Read 37 times) previous topic - next topic

MORFIN08

HELP
7 LEDS TURN FOR LOVE AND MADE THE APPS BLUETHOT
LETTERS SENT BY YOU TO ARDUINO BLUETHOOTH

AND DID THE CODE ERROR ARDUINO BRAND ME BUT when compiling. THIS IS THE CODE


void setup()
{
    pinMode(2, OUTPUT);
    pinMode(3, OUTPUT);
    pinMode(4, OUTPUT);
    pinMode(5, OUTPUT);
    pinMode(12, OUTPUT);
    pinMode(13, OUTPUT);

    Serial.begin(9600);
   }

void loop()
   {
   char dato = Serial.read();
   if (dato =="a")digitalWrite(2,HIGH);
   if (dato =="b")digitalWrite(2,LOW);
   if (dato =="c")digitalWrite(3,HIGH);
   if (dato =="d")digitalWrite(3,LOW);
   if (dato =="e")digitalWrite(4,HIGH);
   if (dato =="f")digitalWrite(4,LOW);
   if (dato =="g")digitalWrite(5,HIGH]);
   if (dato =="h")digitalWrite(5,LOW);
   if (dato =="i")digitalWrite(12,HIGH);
   if (dato =="j")digitalWrite(12,LOW);
   if (dato =="k")digitalWrite(13,HIGH);
   if (dato =="l")digitalWrite(13,LOW);
 }
   

AWOL

Code: [Select]
   if (dato =='a')


Code: [Select]
digitalWrite(5,HIGH]);
There's your next problem.

Please don't SHOUT
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

pYro_65

Use 'a' instead of "a".

You only want to compare a single character, not a whole string (and you were actually comparing the pointer to the string).

Go Up