Okay, I thin I've figured that out thanks to this posting:
http://forums.adafruit.com/viewtopic.php?f=25&t=25264
I used the second example.
Basically I added this on top of what I already had (I stopped using that char buff I had created):
#define numBufSize 3
char numStr[numBufSize] = { '0','1', '2' }; // just as an example
Then is setup I changed the baudrate to:
Serial.begin(115200);
this won't hopefully make a mess, I usually use 9600...
And finally
// Convert decimal string in numStr to an unsigned integer in num.
// The string is in a fixed size buffer.
// There is no checking for invalid digit characters or number too large.
unsigned long num = 0;
for (int i = 0; i < numBufSize; i++) {
num = num * 10 + (packetBuffer[i] - '0');
}
// Serial.println(num);
if (packetBuffer[0]=='P') {
r1val=num - 3200;
}
if (packetBuffer[0]=='Q') {
r2val=num - 3300;
}
if (packetBuffer[0]=='R') {
r3val=num - 3400; // reads the value coming from Processing related to category 3
}
if (packetBuffer[0]=='S') {
r4val=num - 3500;
}
Now, I know this isn't the cleanest code of all, but for now it does the job.
Just in case it might be helpful for someone else.
So, everything works, except for those values which only have one unit (1, 2, 3, 4 etc to 9), they become (19, 29, 39.... 99)
Does anyone know what is happening in the UDP translation of the values from Processing.