Communication between 2 mbed

05 May 2011

Hello,

I have 2 mbed, and I want communicate with the Serial port

I mbed send the information, the second receive.

Serial sendmbed(p9,p10);

sendmbed.printf("%d", value between 0 and 100);

Serial receivembed(p28,p27);

//And after ?? A scanf ?

Can you explain me please !

Thanks you

05 May 2011

Nobody know ?

05 May 2011

What do you want to do ? As. Far as the printf statement .. ing R =rand(); R = R & oxff; Printf ("%d",R); value between o -> 255

Also you need to cross over tx and rx, (also rx and tx).

Enjoy

Ceri.

05 May 2011

Could you skip the use of printf() and scanf() all together and just send/receive the bytes raw? printf() might be overkill if the data being sent between the two devices never needs to be read by a human.

#include "mbed.h"

Serial SerialToMbed(p9, p10);

// Code to send byte from one mbed to another
void SendByte(char ByteToSend)
{
    SerialToMbed.putc(ByteToSend);
}

// Code to receive byte from other mbed
char ReceiveByte()
{
    return SerialToMbed.getc();
}

// Insert you own main function with the logic that you require
06 May 2011

Thanks but how receive string ?