7 years, 6 months ago.

Serial com between RS485 and Leddar system

hello i am a beginner for mbed and leddar sensor. I have a very simple question, I just want to read the data get from the leddar sensor to the mbed using tera term, however there's nothing happen in tera term. This is my very simple code, is this okay to read the address?

/media/uploads/kimyong95/testing2_lpc1768_-4-.bin

  1. include "mbed.h"

Serial pc(USBTX,USBRX);

Serial RS485(p9,p10);

int main()

{

pc.baud(115200);

RS485.baud(11520);

RS485.putc(0x01);

while(RS485.readable())

{

pc.putc(RS485.getc());

printf("b");

}

}

1 Answer

7 years, 6 months ago.

Please use the <<code>> tags when posting your code to keep it readable.

Your RS485 may be set to the wrong baudrate: RS485.baud(11520), probably should be 115200. Is your hardware RS485 driver Ok? Can you see any text in teraterm, print some message even before you try to read from the RS485 channel.

thank you so much for your reply! I have fixed the problem, it is because i have to set the period to the correct millisecond in order for the leddar sensor to send back the data. Thanks

posted by Valerie Chang 03 Oct 2016