Parsing I2C data received from Raspberry Pi not giving correct output

I have tried all I can think of to get the “Command” and “Parameter” values from the following Arduino code function:

void ParseI2CData()
{

char *p = I2CinBuffer; // The data to be parsed
char *str; // Temp store for each data chunk
int count = 0; // Id ref for each chunk

while ((str = strtok_r(p, " ,", &p)) != NULL) // seperate at each “,” delimiter,", &p)) != NULL) // seperate at each “,” delimiter
{
inParse[count] = str; // Add chunk to array
count++;
}

if(count == 2) // If the data has two values then…
{
Command = inParse[0]; // Define value 1 as a Command identifier
Serial.print("Command from I2C is… ");
Serial.println(inParse[0]);
Parameter = inParse[1]; // Define value 2 as a Parameter value
Serial.print("Parameter from I2C is… ");
Serial.println(inParse[1]);
}
}

pre-defined variables are set as follows:
#define REG_MAP_SIZE 32 // Raw Buffer for the incoming I2C data
String Command = “”; // The parsed Command from the RPi
String Parameter = “”; // The parsed Parameter from the RPi
char I2CinBuffer[REG_MAP_SIZE]; // Raw Buffer for the incoming I2C data
in that order

If I insert this CODE snippet before this function:

// THIS SHOWS CORRECT VALUES ARE IN I2CinBuffer (e.g. 6, 100)
int i;
for (i = 0; i < 8; i = i + 1) {
Serial.print(I2CinBuffer*);*

Please post your code. Use code tags.

#define SLAVE_ADDRESS 0x33 // I2C slave address
#define REG_MAP_SIZE 32 // Max I2C Buffer size

#include <Wire.h> // Include the Wire library so we can use I2C.

String Command = “”; // The parsed Command from the RPi
String Parameter = “”; // The parsed Parameter from the RPi

char I2CinBuffer[REG_MAP_SIZE]; // Raw Buffer for the incoming I2C data
byte I2CoutBuffer[REG_MAP_SIZE]; // Buffer for the outgoing I2C data

String inString = “”; // Storage for data as string
int index = 0;

boolean stringComplete = false; // Tells the main loop that it has received
// a command via the Serial port

boolean I2CComplete = false; // Tells the main loop that it has received
// a command via I2C

Serial.begin(115200);

Wire.begin(SLAVE_ADDRESS); Serial.println(“I2C Initiated.”);

Wire.onReceive(receiveEvent); // Set up Receive Interrupt Service Routine

if (I2CComplete) // if I2C commands are available, read it:
{
ParseI2CData(); // Parse the recieved data
inString = “”; // Reset inString to empty
I2CComplete = false; // Reset the system for further input of data
}

void receiveEvent(int howMany) {
int readCount = Wire.readBytes(I2CinBuffer, howMany);
I2CinBuffer[readCount] = 0;
I2CComplete = true;
}

// Take the Comma separated I2C string and format it to Command and Parameter
void ParseI2CData()
{
char *p = I2CinBuffer; // The data to be parsed
char *str; // Temp store for each data chunk
int count = 0; // Id ref for each chunk

while ((str = strtok_r(p, “,”, &p)) != NULL) // seperate at each “,” delimiter
{
inParse[count] = str; // Add chunk to array
count++;
}
// Serial.print(I2CinBuffer); Serial.print(" "); Serial.println(count);

if(count == 2) // If the data has two values then…
{
Command = inParse[0]; // Define value 1 as a Command identifier
Serial.print("Command from I2C in is… "); Serial.println(Command);
Parameter = inParse[1]; // Define value 2 as a Parameter value
Serial.print("Parameter from I2C in is… "); Serial.println(Parameter);

processCommand();
}
}

I have tried all I can think of to get the "Command" and "Parameter" values from the following Arduino code function:

My thanks to any responders and to "unix guru" at

"http://letsmakerobots.com/blog/unixguru/controlling-raspberry-pi-arduino-bot-internet-part-3-3"

from where this code was derived.

Please post your code. Use code tags. Post any and all compilation errors.