working with data from serial works then doesn't

What I am trying to do is enter 3 words via serial monitor at one time, separate the 3 words and print them back to the screen individually. Before data is entered I want the printed values to be what they start with(in this case the string 'EMPTY') After data is entered I want the data to continue to print the entered values until new values are entered via the serial port and then it should print those newer values.
Seems simple, but I can't seem to quite get it to work.
Actually I am seeing 3 sections where the code is doing things other than what I think it should be doing and I don't understand why.
This is after Googling this a lot. This is after watching videos of similar concepts working. This is after reading many many examples of reading serial input. Often with poor/missing comments or weird variable names that make things confusing as to what is going on or working with variable types that work differently than what I am doing here so it doesn't work.

So here is the code..

#define LED  9 //Have a LED on pin 9
#define bufferLimit 50 //setting a limit on my buffer I dump serial data into(50 seems common in examples)
#define breakInputPoint ",.| " //things that help break the buffer into chunks

char * A = "empty"; //Basically to have something in the 3 arrays/pointers before starting
char * B = "empty"; //So if I comment out checkSerial() and splitBufferIntoParts(inputBuffer)
char * C = "empty"; //in void loop() it will print 'EMPTY' for A,B and C when program runs

char inputBuffer[bufferLimit]; //sets the size of where I dump the serial data buffer
int bufferReadingPosition = 0; //keeps track of where I am reading the buffer


void setup() {

  Serial.begin(9600); //allows sending and receiving of data over the serial monitor
  pinMode(LED, OUTPUT); //So my LED will light up when called
  Serial.println("<Arduino Active>"); //So I know on serial monitor that program has started

}


void loop() {
  digitalWrite(LED, LOW); //turns LED off when program starts
  checkSerial();  //looks at the serial port for incomming data and if data is there stuff data into inputBuffer
  splitBufferIntoParts(inputBuffer); //take the big chunk of data from serial and break it into 3 smaller chunks
  printParts(); //print the 3 smaller chunks on the serial monitor

}
void checkSerial() {
  while (Serial.available() > 0)   //so while data is in the serial buffer waiting to be read do this below
  {
    digitalWrite(LED, HIGH); //turn on the LED so can visually see stuff is in the serial buffer
    char charBuffer = Serial.read();     //read the first character in the serial port buffer
    if (charBuffer == '/n') {           //check to see if it is a line terminator and if so reset everything and we are done reading
      inputBuffer[bufferReadingPosition] = 0;
      bufferReadingPosition = 0;
    }
    else if (bufferReadingPosition < bufferLimit) { //if I have room in my buffer for additional input from serial

      inputBuffer[bufferReadingPosition++] = charBuffer; //stuff the next character into my buffer at the next position in my buffer
    }
  }
}
void splitBufferIntoParts(char * processingBuffer) {
  char* first;          //always sending 3 'things' via serial port to Arduino so splitting them into 3 chunks
  char* second;
  char* third;
  first = strtok(processingBuffer, breakInputPoint); //read my buffer until hitting a ,.| or <space> (break point)
  second = strtok(NULL, breakInputPoint); //read buffer from first break point to second break point
  third = strtok(NULL, breakInputPoint); //read buffer from second break point to third break point (if there)
  A = first; //stuff what was read before the first break point into A
  B = second;//stuff the middle bit into B
  C = third;//stuff the rest into C

}
void printParts(){
  Serial.print ("A= ");
  Serial.println (A); //print what I stuffed into A
  Serial.print ("B= ");
  Serial.println (B); //print what I stuffed into B
  Serial.print ("C= ");
  Serial.println (C);//print what I stuffed into C
  delay(5000); //wait 5 seconds so stuff doesn't scroll by so fast on serial monitor
  
}

Now first issue is when program first runs. Before any serial input has arrived to my Arduino my values for A,B and C have all changed because I get this on serial monitor

A= B= C=

But if I comment out my checkSerial and splitBufferIntoParts functions in void loop..

void loop() {
  digitalWrite(LED, LOW); //turns LED off when program starts
  //checkSerial();  //looks at the serial port for incomming data and if data is there stuff data into inputBuffer
  //splitBufferIntoParts(inputBuffer); //take the big chunk of data from serial and break it into 3 smaller chunks
  printParts(); //print the 3 smaller chunks on the serial monitor

}

..the serial monitor displays the values for A,B and C that they start with.

A= empty B= empty C= empty

Original values are being overwritten with 'nothingness'. Which ok, I can somewhat see how that might happen. I need to somehow prevent splitBufferIntoParts from running before I get any serial input so it doesn't overwrite my initial values for A,B and C.

So first question would be how do I accomplish that?

Now the second issue(and this is what really confuses me) is when I input data in the serial monitor.
For example I type in Arduino,Raspberry,BeagleBone into the serial input textbox. I get the following output on the serial monitor.

A=
B=
C=
A= Arduino
B= Raspberry
C= BeagleBone

So I think 'yippie this part is working'. It took my 3 words inputted together, split them up and printed them. But....
After my 5 second delay I get this :

A= Arduino
B= Raspberry
C= BeagleBone
<5 second delay>
A= Arduino
B=
C=
A= Arduino
B=
C=

Where did the values of B and C go? And if they were overwritten with 'nothingness' again why wasn't A overwritten?

Also at this point the third issue of the code appears.
It ignores any more serial input.
That is if I say now type Alpha,Beta,Delta into the serial input textbox the serial monitor still keeps repeating

A= Arduino
B=
C=
A= Arduino
B=
C=
A= Arduino
B=
C=

So please explain using the variables I am using how to get my code to do what I am wanting to do.

if (charBuffer == '/n')

Did you mean '\n' ?

guix:

if (charBuffer == '/n')

Did you mean '\n' ?

Awesome, that fixed issue 3. Now I can enter new values.
Thank you for that.

The values for B and C still disappear though after they print to screen once.

You should not constantly call splitBufferIntoParts, instead, only call it when a '\n' was found. Try something like this:

bool checkSerial(){
    ...
    if (charBuffer == '\n') {
        ....
        return true;
    }
    ...
    return false;
}

Then make a condition to only call splitBufferIntoParts if this function returned true

if ( checkSerial() ) 
    splitBufferIntoParts(inputBuffer);

But honestly your code is crap, consider reading this: Gammon Forum : Electronics : Microprocessors : How to process incoming serial data without blocking

:wink:

guix:
You should not constantly call splitBufferIntoParts, instead, only call it when a '\n' was found. Try something like this:

bool checkSerial(){

...
    if (charBuffer == '\n') {
        ....
        return true;
    }
    ...
    return false;
}




Then make a condition to only call splitBufferIntoParts if this function returned true


if ( checkSerial() )
    splitBufferIntoParts(inputBuffer);




But honestly your code is crap, consider reading this: http://www.gammon.com.au/serial

;)

I've hit that page a good 5-10 times over the last couple of days trying to figure this out. A good bit of what I've tried is based on that as far as I can understand it. But it doesn't seem like any data is saved once it is out of a function. So converting and printing all have to stay in the same function. I am trying to make the code more modular so I can change printing the values to serial(my printParts function) to doing something else with those values without needing to touch the code involved with the serial port reading or the code that splits the readings into parts. The printing is just a check to make sure the data is being captured and retained properly. So far that's a fail.

Tried the bool thing as suggested (probably implemented incorrectly)

#define LED  9 //Have a LED on pin 9
#define bufferLimit 50 //setting a limit on my buffer I dump serial data into(50 seems common in examples)
#define breakInputPoint ",.| " //things that help break the buffer into chunks

char * A = "empty"; //Basically to have something in the 3 arrays/pointers before starting
char * B = "empty"; //So if I comment out checkSerial() and splitBufferIntoParts(inputBuffer)
char * C = "empty"; //in void loop() it will print 'EMPTY' for A,B and C when program runs

char inputBuffer[bufferLimit]; //sets the size of where I dump the serial data buffer
int bufferReadingPosition = 0; //keeps track of where I am reading the buffer


void setup() {

  Serial.begin(9600); //allows sending and receiving of data over the serial monitor
  pinMode(LED, OUTPUT); //So my LED will light up when called
  Serial.println("<Arduino Active>"); //So I know on serial monitor that program has started

}


void loop() {
  digitalWrite(LED, LOW); //turns LED off when program starts
  if (checkSerial()){  //looks at the serial port for incomming data and if data is there stuff data into inputBuffer
  splitBufferIntoParts(inputBuffer); //take the big chunk of data from serial and break it into 3 smaller chunks
  }
  printParts(); //print the 3 smaller chunks on the serial monitor

}
bool checkSerial() {
  
  while (Serial.available() > 0)   //so while data is in the serial buffer waiting to be read do this below
  {
    digitalWrite(LED, HIGH); //turn on the LED so can visually see stuff is in the serial buffer
    char charBuffer = Serial.read();     //read the first character in the serial port buffer
    if (charBuffer == '\n') {           //check to see if it is a line terminator and if so reset everything and we are done reading
      inputBuffer[bufferReadingPosition] = 0;
      bufferReadingPosition = 0;
      return true;
    }
    else if (bufferReadingPosition < bufferLimit) { //if I have room in my buffer for additional input from serial

      inputBuffer[bufferReadingPosition++] = charBuffer; //stuff the next character into my buffer at the next position in my buffer
      return false;
    }
    
  }
}
void splitBufferIntoParts(char * processingBuffer) {
  char* first;          //always sending 3 'things' via serial port to Arduino so splitting them into 3 chunks
  char* second;
  char* third;
  first = strtok(processingBuffer, breakInputPoint); //read my buffer until hitting a ,.| or <space> (break point)
  A = first; //stuff what was read before the first break point into A
  second = strtok(NULL, breakInputPoint); //read buffer from first break point to second break point
  B = second;//stuff the middle bit into B
  third = strtok(NULL, breakInputPoint); //read buffer from second break point to third break point (if there)
  C = third;//stuff the rest into C
 

}
void printParts(){
  Serial.print ("A= ");
  Serial.println (A); //print what I stuffed into A
  Serial.print ("B= ");
  Serial.println (B); //print what I stuffed into B
  Serial.print ("C= ");
  Serial.println (C);//print what I stuffed into C
  delay(5000); //wait 5 seconds so stuff doesn't scroll by so fast on serial monitor
  
}

Tried using it a couple of different ways.
Seems like checkSerial is not true long enough for splitBufferIntoParts to run or something. The values for A,B and C never change regardless of serial input.
Serial output is always

A= empty B= empty C= empty A= empty B= empty C= empty A= empty B= empty C= empty

no matter what I type in the serial text box. So splitBufferIntoParts never seems to be running.

But it doesn't seem like any data is saved once it is out of a function.

Yes, it is. Your problem is that you do not understand pointers. You have three pointers that point to literal strings. You try to make them point to somewhere that goes out of scope. You can't do that.

You should ditch the pointers. Create REAL arrays, with REAL storage - big enough to hold the maximum length word you want to deal with. Then, when strtok() returns a pointer to some data, COPY that data to YOUR storage location(s).

So first question would be how do I accomplish that?

Unless you are just interested in code logic, just what is the end result you are looking for?

Frostline:
The values for A,B and C never change regardless of serial input.
Serial output is always no matter what I type in the serial text box. So splitBufferIntoParts never seems to be running.

They do change for me. When I type in three new words, they are split and printed correctly. But in between times is a mess because strtok has null terminated all the fields. That is why only the first field is printed.

But I suspect it will not work if A,B, or C have more characters than "empty" (7 characters to be specific). That's how you declared them.

But I suspect it will not work if A,B, or C have more characters than "empty" (7 characters to be specific). That's how you declared them.

A pointer that points to one character can be changed to point to 7000 characters, so this suspicion is unfounded.

PaulS:
A pointer that points to one character can be changed to point to 7000 characters, so this suspicion is unfounded.

I see your general point, however he did not change it.

aarg:
I see your general point, however he did not change it.

Who didn't change what?

OP is not correctly changing what A, B, and C point to, since they all end up pointing to the same thing, and what they point to goes out of scope when the function ends.

However, if OP had used:

A = strdup(strtok(processingBuffer, breakInputPoint));

then, OP would have changed where A pointed, making it point to more characters, fewer characters, or the same number of characters, that it originally had pointed to.

Of course, OP would then have needed to call free() at some point, to make that memory available for use again.

On return from splitBufferIntoParts(), don't A, B, and C point to addresses in processingBuffer (which is non-local, so doesn't go out of scope)?

The function can be replaced with:

void splitBufferIntoParts(char * processingBuffer) {
  A = strtok(processingBuffer, breakInputPoint); //read my buffer until hitting a ,.| or <space> (break point)
  B = strtok(NULL, breakInputPoint); //read buffer from first break point to second break point
  C = strtok(NULL, breakInputPoint); //read buffer from second break point to third break point (if there)
}

That's all it really does. Not saying it's great.

PaulS:
Yes, it is. Your problem is that you do not understand pointers. You have three pointers that point to literal strings. You try to make them point to somewhere that goes out of scope. You can't do that.

You should ditch the pointers. Create REAL arrays, with REAL storage - big enough to hold the maximum length word you want to deal with. Then, when strtok() returns a pointer to some data, COPY that data to YOUR storage location(s).

You are quite correct in that I have no understanding of pointers.
There is some key element of them that has just not 'clicked' in my mind yet. It is driving me crazy because it is a major stumbling block to everything I attempt to do it seems.
I thought I was making them point to the global declarations for them. So values would be saved outside of the function by overwriting what they started with. Guess not.
I tried declaring them as just arrays at first.
But kept getting errors like can't use char* type with char[5] type or similar when trying to put the strtok output into them.

Now it seems I am loosing ground. That it my results (though not right) were closer to what I wanted in my first posted code than they are now.
Currently using the making the checkSerial return a bool and then only doing splitBufferIntoParts when it returns true never worked as I tried to implement it. Though I understand it 'should' work, I basically messed it up so I took it back out while attempting to go back to arrays instead of pointers as suggested. I couldn't see if my arrays were working otherwise since the output never changed.

So now I have this code

#define LED  9 //Have a LED on pin 9
#define bufferLimit 50 //setting a limit on my buffer I dump serial data into(50 seems common in examples)
#define breakInputPoint ",.| " //things that help break the buffer into chunks
#define stringLength 4  //makes it easier to change lengths of things many places at once

char A[stringLength]; //setting global storage arrays
char B[stringLength];
char C[stringLength];

char inputBuffer[bufferLimit]; //sets the size of where I dump the serial data buffer
int bufferReadingPosition = 0; //keeps track of where I am reading the buffer


void setup() {

  Serial.begin(9600); //allows sending and receiving of data over the serial monitor
  pinMode(LED, OUTPUT); //So my LED will light up when called
  Serial.println("<Arduino Active>"); //So I know on serial monitor that program has started

}


void loop() {
  digitalWrite(LED, LOW); //turns LED off when program starts
  checkSerial();  //looks at the serial port for incomming data and if data is there stuff data into inputBuffer
  splitBufferIntoParts(inputBuffer); //take the big chunk of data from serial and break it into 3 smaller chunks
 printParts(); //print the 3 smaller chunks on the serial monitor

}
bool checkSerial() {

  while (Serial.available() > 0)   //so while data is in the serial buffer waiting to be read do this below
  {
    digitalWrite(LED, HIGH); //turn on the LED so can visually see stuff is in the serial buffer
    char charBuffer = Serial.read();     //read the first character in the serial port buffer
    if (charBuffer == '\n') {           //check to see if it is a line terminator and if so reset everything and we are done reading
      inputBuffer[bufferReadingPosition] = 0;
      bufferReadingPosition = 0;
      return true;
    }
    else if (bufferReadingPosition < bufferLimit) { //if I have room in my buffer for additional input from serial

      inputBuffer[bufferReadingPosition++] = charBuffer; //stuff the next character into my buffer at the next position in my buffer
      return false;
    }

  }
}
void splitBufferIntoParts(char * processingBuffer) {
  char* first;          //always sending 3 'things' via serial port to Arduino so splitting them into 3 chunks
  char* second;
  char* third;
  
  first = strtok(processingBuffer, breakInputPoint); //read my buffer until hitting a ,.| or <space> (break point)
  strcpy(A,first);
  
  second = strtok(NULL, breakInputPoint); //read buffer from first break point to second break point
  strcpy(B,second);
  
  third = strtok(NULL, breakInputPoint); //read buffer from second break point to third break point (if there)
  strcpy(C,third);
  
}
void printParts() {
  Serial.print ("A= ");
  Serial.println (A); //print what I stuffed into A
  Serial.print ("B= ");
  Serial.println (B); //print what I stuffed into B
  Serial.print ("C= ");
  Serial.println (C);//print what I stuffed into C
  delay(5000); //wait 5 seconds so stuff doesn't scroll by so fast on serial monitor

}

And it doesn't work. Shocking I know.

Now when I enter 3 words cat,dog,zip I get this output

A= c
B=
C=
A= ca
B=
C=
A= cat
B=
C=
A= cat
B=
C=
A= cat
B=
C=

Whereas before it at least printed the 3 words instantly and together, now it prints the first word a letter at a time for A, then nothing for B and C.
So thinking 'why not' I entered dog,ray,usb into the text box to see what would happen.

And got..

A= cat
B=
C=
A= dat
B=
C=
A= dot
B=
C=
A= dog
B=
C=
A= dog
B= dog
C= zip
A= dog
B=
C=
A= dog
B=
C=

This seems really odd. It changed A's value to the new one a letter at a time, then for one cycle it printed the previous values for B and C (so they were around somewhere) and then went back to just printing A's value.

This works. I'm not trying to improve your code, just trying to make it work. I really only added a flag to check for line input.

#define LED  9 //Have a LED on pin 9
#define bufferLimit 50 //setting a limit on my buffer I dump serial data into(50 seems common in examples)
#define breakInputPoint ",.| " //things that help break the buffer into chunks

char * A = "empty"; //Basically to have something in the 3 arrays/pointers before starting
char * B = "empty"; //So if I comment out checkSerial() and splitBufferIntoParts(inputBuffer)
char * C = "empty"; //in void loop() it will print 'EMPTY' for A,B and C when program runs

char inputBuffer[bufferLimit]; //sets the size of where I dump the serial data buffer
int bufferReadingPosition = 0; //keeps track of where I am reading the buffer

boolean lineReceived;

void setup() {

  Serial.begin(9600); //allows sending and receiving of data over the serial monitor
  pinMode(LED, OUTPUT); //So my LED will light up when called
  Serial.println("<Arduino Active>"); //So I know on serial monitor that program has started

}

void loop() {
  digitalWrite(LED, LOW); //turns LED off when program starts
  checkSerial();  //looks at the serial port for incomming data and if data is there stuff data into inputBuffer
  if (lineReceived == true)
  {
  splitBufferIntoParts(inputBuffer); //take the big chunk of data from serial and break it into 3 smaller chunks
  printParts(); //print the 3 smaller chunks on the serial monitor
  lineReceived = false;
  }
}

void checkSerial() {
  while (Serial.available() > 0)   //so while data is in the serial buffer waiting to be read do this below
  {
    digitalWrite(LED, HIGH); //turn on the LED so can visually see stuff is in the serial buffer
    char charBuffer = Serial.read();     //read the first character in the serial port buffer
    if (charBuffer == '\n') {           //check to see if it is a line terminator and if so reset everything and we are done reading
      inputBuffer[bufferReadingPosition] = 0;
      bufferReadingPosition = 0;
      lineReceived = true;
    }
    else if (bufferReadingPosition < bufferLimit) { //if I have room in my buffer for additional input from serial

      inputBuffer[bufferReadingPosition++] = charBuffer; //stuff the next character into my buffer at the next position in my buffer
    }
  }
}

void splitBufferIntoParts(char * processingBuffer) {
  A = strtok(processingBuffer, breakInputPoint); //read my buffer until hitting a ,.| or <space> (break point)
  B = strtok(NULL, breakInputPoint); //read buffer from first break point to second break point
  C = strtok(NULL, breakInputPoint); //read buffer from second break point to third break point (if there)
}

void printParts() {
  Serial.print ("A= ");
  Serial.println (A); //print what I stuffed into A
  Serial.print ("B= ");
  Serial.println (B); //print what I stuffed into B
  Serial.print ("C= ");
  Serial.println (C);//print what I stuffed into C
}

zoomkat:
Unless you are just interested in code logic, just what is the end result you are looking for?

What I am looking for is to have a set of variables set to 'something' when the program starts and then as input from serial comes in those start-up values are replaced with the new values from serial.
I can think of many applications where this might be wanted.
The project I am working on would initially start with 8 variables with a hex value. Those variables would be passed to an 8x8 led matrix. So on start-up I could start with a blank screen or possibly a graphic. Then as serial input is received the hex values would be replaced, maybe all 8, maybe only one. So then whichever were replaced would change but the others would maintain their previous state.
So right now I am just trying to read/store/display short text strings to try and understand how to get the serial communication to work. I thought (mistakenly) that reading and storing 3 little word strings and then displaying them as they changed would be a relative simple step up from sending a single char from a C# app to turn a LED on or off (that worked fine BTW).

aarg:
This works. I'm not trying to improve your code, just trying to make it work. I really only added a flag to check for line input.

That is very close to what I am wanting functionality wise.
Actually moving the printParts() out of the if loop (and putting delay back) makes it behave exactly how I wanted. I can see my original values are kept until serial input replaces them and then newer serial input replaces those. Awesome. Thank you.

Now if I follow what you did....you basically correctly added a bool check for '\n' being in my serial input so splitBufferIntoParts would only run when a '\n' came in.
I tried a similar idea before starting the thread by calling my splitBufferIntoParts function directly in the if loop that checks for '\n' and it failed.
So why does changing a bool value to call it works but directly calling it where the bool value would be changed does not?
Or could it work and I just had some syntax wrong possibly?

Frostline:
What I am looking for is to have a set of variables set to 'something' when the program starts and then as input from serial comes in those start-up values are replaced with the new values from serial.

In that case you don't want a pointer but an array. Think of a pointer as an address to a place. You can do whatever you like with an envelope with an address written on it, but the place that was on the envelope doesn't change.

So in your case, more like:

char A [20] = "empty"; 
char B [20] = "empty"; 
char C [20] = "empty";

Now you have real memory, with room for 20 bytes in each one. They start off with "empty" in them, and you can change that. BTW, don't use upper-case strings for variable names, by convention that is reserved for constants.

I thought (mistakenly) that reading and storing 3 little word strings and then displaying them as they changed would be a relative simple step ...

Pointers can be challenging if you aren't used to them, but because of that there are a lot of tutorials on using them in C/C++.

Perhaps the examples in serial input basics would be useful.

...R

The most serious flaw in your program, is that the tokenizing happens in place, right in the input buffer. The simplest way to correct it, without many changes to your program at this time, is to simply make a copy of the input buffer using strcpy(). Also, the delay() function will cause characters to queue up in the serial buffer. That may not present a problem for you now, but it could bite you later. So it is always better to keep an active non-blocking loop using millis(), right from the get-go.

It does not seem to me that you have a problem with constructing a serial input routine, but rather in organizing your high level logic. In any case, I have taken the liberty of modifying it thusly:

#define bufferLimit 80 //setting a limit on my buffer I dump serial data into
#define breakInputPoint ",.| " //things that help break the buffer into chunks

char * paramA = ""; //Basically to have a valid char string in the 3 arrays/pointers before starting
char * paramB = ""; //So if I comment out checkSerial() and splitBufferIntoParts(inputBuffer)
char * paramC = ""; //in void loop() it will print nothing for paramA,paramB and paramC when program runs

char inputBuffer[bufferLimit]; //serial input data buffer
int bufferReadingPosition = 0; //keeps track of where I am reading the buffer
char tokenBuffer[bufferLimit]; //workspace to tokenize string

unsigned long lastMillis;

void setup() {

  Serial.begin(9600); //allows sending and receiving of data over the serial monitor
  pinMode(LED_BUILTIN, OUTPUT); //So my LED will light up when called
  Serial.println("<Arduino Active>"); //So I know on serial monitor that program has started

}

void loop() {
  checkSerial();  //looks at the serial port for incoming data and if data is there stuff data into inputBuffer
  if (millis() - lastMillis >= 5000)
  {
    lastMillis = millis();
    printParts(); //print the 3 smaller chunks on the serial monitor
  }
}

void checkSerial() {
  while (Serial.available() > 0)   //so while data is in the serial buffer waiting to be read do this below
  {
    digitalWrite(LED_BUILTIN, HIGH); //turn on the LED so can visually see stuff is in the serial buffer
    char charBuffer = Serial.read();     //read the first character in the serial port buffer
    if (charBuffer == '\n') {           //check to see if it is a line terminator and if so reset everything and we are done reading
      inputBuffer[bufferReadingPosition] = '\0';
      bufferReadingPosition = 0;
      strcpy(tokenBuffer, inputBuffer);
      splitBufferIntoParts(tokenBuffer); //take the big chunk of data from serial and break it into 3 smaller chunks
      digitalWrite(LED_BUILTIN, LOW); //turn off the LED to show the serial buffer is empty
    }
    else if (bufferReadingPosition < bufferLimit) { //if I have room in my buffer for additional input from serial

      inputBuffer[bufferReadingPosition++] = charBuffer; //stuff the next character into my buffer at the next position in my buffer
    }
  }
}

void splitBufferIntoParts(char * processingBuffer) {
  paramA = strtok(processingBuffer, breakInputPoint); //read my buffer until hitting a ,.| or <space> (break point)
  paramB = strtok(NULL, breakInputPoint); //read buffer from first break point to second break point
  paramC = strtok(NULL, breakInputPoint); //read buffer from second break point to third break point (if there)
}

void printParts() {
  Serial.print ("paramA= ");
  Serial.print (paramA); //print what I stuffed into paramA
  Serial.print (" paramB= ");
  Serial.print (paramB); //print what I stuffed into paramB
  Serial.print (" paramC= ");
  Serial.println (paramC);//print what I stuffed into paramC
}

Again, I'm only making small changes so that you can clearly see the progression.

aarg:
The most serious flaw in your program, is that the tokenizing happens in place, right in the input buffer. The simplest way to correct it, without many changes to your program at this time, is to simply make a copy of the input buffer using strcpy().

First let me say this is great help you are providing. Seeing the changes in my code rather than going through examples that are not quite doing the same thing is a huge benefit to my understand of what is going on. So a big thank you for the time you are taking here.

Now if I am following correctly as soon as inputBuffer changes and hits a '\n' in the code it is copied to tokenBuffer. And then the tokenBuffer is processed. Now being very new to this I guess I am not understanding why that is necessary. It seems that the time span where inputBuffer and tokenBuffer do not always match would be the tiny time period from the beginning of new serial input to the '\n'. So it is adding that time amount to how long tokenBuffer can be processed vs processing inputBuffer directly.
Is there some other reason for copying inputBuffer that I am not seeing?

The other thing I wonder about is the use of \0 instead of just 0 in the code line

inputBuffer[bufferReadingPosition] = '\0';

I tried Googling that and it seems some places say they are the same, some places say it is needed in C but not C++, some places only with char data type. It is somewhat confusing, especially with using Arduino since it isn't quite the same C++ as other implementations.
Honestly I didn't understand the purpose of having the line of code to begin with. I would have thought it would have made more sense to have it be one of the delimiters so strtok would have a clear stopping point.

Anyway, thank you again for the help with all this.
Now I am going to try to use arrays instead of pointers for my global variables as suggested.
Probably be back with more questions if/when that doesn't go as planned.