serialBuffer???

I was following a tutorial for a 2 Axis gcode interpreter, and I found serialBuffer in the code. It is supposed to start reading the buffer from the start. I then get the error "'serialBuffer' was not declared in this scope".

But I don't know how to declare it or what I could use to replace it.

Tutorial Link: How to build an 2-axis Arduino CNC Gcode Interpreter – Marginally Clever Robots

float parseNumber(char code,float val) {
  char *ptr=serialBuffer;  // start at the beginning of buffer
  while((long)ptr > 1 && (*ptr) && (long)ptr < (long)serialBuffer+sofar) {  // walk to the end
    if(*ptr==code) {  // if you find code on your walk,
      return atof(ptr+1);  // convert the digits that follow into a float and return it
    }
    ptr=strchr(ptr,' ')+1;  // take a step from here to the letter after the next space
  }
  return val;  // end reached, nothing found, return default val.
}

Please post a link to the tutorial.

That's a very old link.

Looks like you copied a portion. Post #11183 from here:

looks to have a more complete (though not necessarily more functional) listing that shows a declaration for serialBuffer:

static char serialBuffer[MAX_BUF+1]; // Serial buffer

You need to post all of your code, not just a snippet.

@Blackfin

Thank you

This seemed to have fixed the problem

Even the version in github has the problem. Looks like the name changed from 'buffer' to 'serialBuffer' but not all places were changed. Similarly 'parsenumber' and 'parseNumber' are both used for the same function.