Expected identifier before numeric constant error

Ive made this code but dont know why i get this error. Can someone help me maybe.
Thanks :slightly_smiling_face:

#define MotorBewegenLinks 7
#define MotorBewegenRechts 8
#define Punt1 4
#define Punt2 5
#define Punt3 6
#define Start 10
#define Stop 2
#define Noodstop 3
#define Sensor 9
#define Herstel 11
#define bakopen 12
#define bakdicht 13
int stap = 0;
int status_pauze = 0;
int Noodstop_memory = 0;
int Teller_herstel = 0;
int Teller = 0;
bool edge = 1;
int noodstop = 0;

void setup() {

  Serial.begin(9600);

  
    pinMode(Punt1, OUTPUT);
    pinMode(Punt2, OUTPUT);
    pinMode(Punt3, OUTPUT);
    pinMode(MotorBewegenLinks, OUTPUT);
    pinMode(MotorBewegenRechts, OUTPUT);
    pinMode(Start, INPUT);
    pinMode(Stop, INPUT);
    pinMode(Noodstop, INPUT);
    pinMode(Sensor, INPUT);
    pinMode(Herstel, INPUT);
    pinMode(bakopen, OUTPUT);
    pinMode(bakdicht, OUTPUT);
    
    attachInterrupt(digitalPinToInterrupt(Stop), Pauze, RISING);
    attachInterrupt(digitalPinToInterrupt(Noodstop), noodstop, RISING);    
}

void loop() {

  if(digitalRead(Start) && digitalRead(Sensor)){
      stap = 1;
     for(int i = Punt1; i <= Punt3; i++){
      water(i);
      
    }
  }
}

void water(int punt){

  if (Noodstop == HIGH){
    digitalWrite(Noodstop_memory, HIGH);
  }
  
if (Noodstop_memory == LOW){
  digitalWrite(MotorBewegenRechts, HIGH);
  Serial.println("Motor links aan");
   delay(1000);
   }
   else
   {
    goto Herstel;
   }
 if  (Noodstop_memory == LOW){
  digitalWrite(MotorBewegenRechts, LOW);
  Serial.println("Motor links uit");
  delay(500);
  }
     else
   {
    goto Herstel;
   }
   if (Noodstop_memory == LOW){
  digitalWrite(punt, HIGH);
  Serial.println("Aangekomen bij punt");
  delay(500);
   }
      else
   {
    goto Herstel;
   }
   if (Noodstop_memory == LOW){
  digitalWrite(bakopen, HIGH);
  Serial.println("Bak open");
  delay(1000);
   }
      else
   {
    goto Herstel;
   }
   if (Noodstop_memory == LOW){
  digitalWrite(bakopen, LOW);
  delay(500);
   }
      else
   {
    goto Herstel;
   }
   if (Noodstop_memory == LOW){
    digitalWrite(bakdicht, HIGH);
    Serial.println("Bak dicht");
    delay(1000);
   }
      else
   {
    goto Herstel;
   }
     if (Noodstop_memory == LOW){
    digitalWrite(bakdicht, LOW);
    delay(500);
     }
     else
   {
    goto Herstel;
   }
     if (Noodstop_memory == LOW){
  digitalWrite(punt, LOW);
  Serial.println("Weg bij punt");
     }
    else
   {
    goto Herstel;
   }

  if ( punt == Punt3){
    digitalWrite(MotorBewegenLinks, HIGH);
    Serial.println("Motor terug naar begin");
    delay(3000);
    digitalWrite(MotorBewegenLinks, LOW);
    Serial.println("Motor bij begin");
   }
   }
  


void Herstel(){

 if (Herstel == HIGH){

  digitalWrite(bakopen, LOW);
  digitalWrite(bakdicht, HIGH);
  digitalWrite(MotorBewegenRechts, LOW);
  digitalWrite(MotorBewegenLinks, HIGH);
  delay(2000);
  digitalWrite(Noodstop_memory, LOW);
  
 }
 

}


void Pauze(){
 edge = 1;
 status_pauze = !status_pauze;
 while (status_pauze == 1){
   Serial.println(status_pauze);
 if (digitalRead(Stop) && edge == 0){break;}
 delay(1000);
 Serial.println("Pauze hoog");
 if (digitalRead(Stop) == 0){
  Serial.println("Pauze laag");

    edge = 0; 
  }
 }
}

Your post was MOVED to its current location as it is more suitable

goto Herstel; ? is that a function call for you ?

you have

#define Herstel 11

and

void Herstel() {

also noodstop is not an ISR... it's an int, so this is weird

  attachInterrupt(digitalPinToInterrupt(Noodstop), noodstop, RISING);
    goto Herstel;

What do you think these lines do ?

Did you mean to call the Herstel() function ? If so then you will need to change the name of the function otherwise the #define for that name will not compile

yeah its a function call. so i need to change it?
yeah i see its useless indeed

Herstel();

No "goto". (There is a 'C' goto, but it's completely different from its use in BASIC).
And like J-M-L noted, you cannot have an Input and a Function with the same 'name'.

Mostly in the sense that it is very rarely used in C/C++ and almost impossible to avoid in any significant BASIC program.

At least your father’s BASIC. :expressionless:

a7

"I resemble that remark."

Haha, tee moo.

I should have said "at least not your grandfather's BASIC". :stuck_out_tongue:

a7

I recommend your change your "#define" preprocessor directives that assign names to pin numbers to the more modern "const byte" style:

const byte MotorBewegenLinks = 7;
const byte MotorBewegenRechts = 8;
const byte Punt1 = 4;
const byte Punt2 = 5;
const byte Punt3 = 6;
const byte Start = 10;
const byte Stop = 2;
const byte Noodstop = 3;
const byte Sensor = 9;
const byte Herstel = 11;
const byte bakopen = 12;
const byte bakdicht = 13;

Then you will get more useful messages, like:

sketch_jan06b:156:14: error: 'void Herstel()' redeclared as different kind of symbol
 void Herstel()
              ^
sketch_jan06b.ino:10:12: note: previous declaration 'const byte Herstel'
 const byte Herstel = 11;
            ^~~~~~~

and

sketch_jan06b.ino: In function 'void water(int)':
sketch_jan06b:74:10: error: label 'Herstel' used but not defined
     goto Herstel;
          ^~~~~~~

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.