Serial Between Arduino And Picaxe

Hi guys,

I have a quick question, for the last hour or two, I've been trying to get a Picaxe to communicate over serial to an Arduino.
I have a 7-Pin matrix keypad and decided to use a spare Picaxe I had lying around to interface with the Keypad and respond on key-release to the Arduino.

I've ran into a problem though that I can't solve tonight, and I understand this really is more or less an Arduino only forum, but I'm hoping it has nothing to do with the Picaxe and more of something I'm overlooking on the Arduino.

I'm using a SoftwareSerial on a UNO board, and taking input from Pin 10. On key release, the Picaxe outputs I assume ASCII code for whatever key was pressed (serout ("1") and so on...) and 10/11 for star and hash.

This is working fine, but the issue I'm having is when I push star or hash, instead of Serial.read() giving me say "11", I get "1" and then another "1".

serial.available() is always 1 as well, I was assuming that the buffer would catch two values, and then I could read them out adding them into a char array perhaps, but yeah. I'm not sure what the issue is, I'm probably missing something.

Thanks for any advice! :~

May be an issue with your arduino code you did not post

I'm using a SoftwareSerial on a UNO board, and taking input from Pin 10. On key release, the Picaxe outputs I assume ASCII code for whatever key was pressed (serout ("1") and so on...) and 10/11 for star and hash.

Why 10/11 for * & # instead of just sending them as ASCII also? Do you have the ability to alter the picaxe code?

I can alter the Picaxe code, yeah. But isn't "11" sent as one message though, so available() would return 2 and I can do something like this:

String c;
while(software_serial.available() > 0) {
c += (char)software_serial.read();
}

Instead available = 1, I read, then it returns 1 again. But that's basically how I'm trying to do it.

I'll probably just alter the Picaxe code then though, if it's the easy way out. But I'd prefer the current method.

aaroncm:
I can alter the Picaxe code, yeah. But isn't "11" sent as one message though, so available() would return 2 and I can do something like this:

But if the arduino serial read code is in a fast loop it will only see and one at a time. It will read the first byte and think it's a "1" and then the other "1" would arrive, now is this 2x 1 presses or 11? Better to either use a 2 byte code for all keys so you know you need two bytes, use unique codes for each key (having 1 & 11 will confuse) or using a message terminator so you know when all the message has arrived.