Error: ISO C++ Forbids...

Can anybody please explain to me what’s wrong with my code ? I get a error :frowning:

Here’s my code:

int inPin1      = 0;
int inPin2      = 1;
int inPin3      = 2;
int inPin4      = 3;

int newgamePin    = 7;
int checkPin      = 5;
int afruimenPin   = 3;

int val1        = 0;
int val2        = 0;
int val3        = 0;
int val4        = 0;
int val5        = 0;
int val6        = 0;
int val7        = 0;

int delay1      = 0;
int delay2      = 0;
int delay3      = 0;
int delay4      = 0;
int delay5      = 0;
int delay6      = 0;
int delay7      = 0;

char var        = "a";

int led1        = 12;
int led2        = 13;

void setup() {
  pinMode(inPin1, INPUT);
  pinMode(inPin2, INPUT); 
  pinMode(inPin3, INPUT); 
  pinMode(inPin4, INPUT); 
  
  pinMode(newgamePin, INPUT); 
  pinMode(checkPin, INPUT);
  pinMode(afruimenPin, INPUT);
  
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);

  Serial.begin(9600);
}

void loop() {
  val1 = analogRead(inPin1);
  val2 = analogRead(inPin2);
  val3 = analogRead(inPin3);
  val4 = analogRead(inPin4);
  
  val5 = digitalRead(newgamePin);
  val6 = digitalRead(checkPin);
  val7 = digitalRead(afruimenPin);
  
  if (val1 == HIGH) {
    Serial.flush();
    Serial.print("1"); 
  }

  if (val2 == HIGH) {
    Serial.flush();
    Serial.print("2"); 
  }
  
  if (val3 == HIGH) {
    Serial.flush();
    Serial.print("3"); 
  }
  
  if (val4 == HIGH) {
    Serial.flush();
    Serial.print("4"); 
  }
  
  // NIEUW SPEL

  if (val5 == HIGH) {
    Serial.flush();
    Serial.print("a"); 
  }
  
  // CHECK
  
  if (val6 == HIGH) {
    Serial.flush();
    Serial.print("b"); 
  }
  
  // AFRUIMEN

  if (val7 == HIGH) {
    Serial.flush();
    Serial.print("c"); 
  }
  
  // SPEL RESETEN

  if (Serial.available() > 0) {
    var = Serial.read();

    if (var == "a") {
      digitalWrite(led1, HIGH);      
    }
    
    else if (var == "b") {
      digitalWrite(led2, HIGH);      
    }
    
    else {
      delay1 = 0;
      delay2 = 0;
      delay3 = 0;
      delay4 = 0;
      delay5 = 0;
      delay6 = 0;
      delay7 = 0;
    }
  }
}

Thanks :sunglasses:

Change var == “b” to var == ‘b’. Strings go in double quotes, characters in single quotes, and you can’t compare a character to a string.

Works fine, thanks for the quick service :).

By the way… if you need something for your website (arduino.cc) about the connection between the Arduino and Visual Basic 2005, let me now :).