Some help...
//You need space for the null terminator, since you want 3 characters you need an extra to the null terminator 3+1
#define STR 4
char buffer[STR];
//--------------------------------------------------
void setup(){
Serial.begin(9600);
}
//---------------------------------------------------
void loop(){
if (Serial.available() <0) { //Ok if you dont have nothing print like crazy ...
Serial.print("Empty");
delay(1000);
}
if (Serial.available() >=3) {//It will need 3 bytes to run, this way you insure it's safe to read the 3 bytes in a while loop
//Serial comunication are very slow, if you try to read the 3 bytes when you detect the first one you will not get the next because the second one hasn't arrived yet
int i = 0;
while (i <= 2) {
Serial.print(i);
buffer[i++] = Serial.read();//Use i and then increment it after
}
buffer[3] = '\0';//In order to print it below like a string you need to terminate the char array with a 0
Serial.print("OK I received");
Serial.println(buffer); //Here you should get the string correctly
}
}
Obvios this is presuming you are just sending 3 characters from the VB