I only know enough to be dangerous, but I'll give it a go.
I assume you mean to send the data "222232" from one to the other?
Maybe something like this
#include <stdlib.h>
char X_buffer[3];
char Y_buffer[3];
int received;
int i=0;
int X_pos=0;
int Y_pos=0;
void setup()
{
Serial.begin(57600);
received = 0;
X_buffer[received] = '\0';
Y_buffer[received] = '\0';
Serial.print("setup");
}
void loop()
{
if (Serial.available())
{
// Get x cord
for(i=0; i<3; i++)
{
X_buffer[i] = Serial.read();
}
// Get y cord
for(i=0; i<3; i++)
{
Y_buffer[i] = Serial.read();
}
X_pos = atoi(X_buffer);
Y_pos = atoi(Y_buffer);
}
/*
Serial.println(buffer);
Serial.print("1: ");
Serial.println(myInt/10);
Serial.print("2: ");
Serial.println(myInt/100);
Serial.print("3: ");
Serial.println(myInt%10);
Serial.print("4: ");
Serial.println(myInt%100);
received = 0;
}
}*/
}