Transmit commands

17 Nov 2012

Hello, mbed pros! I am new to mbed. I connect mbed to pc and want to transmit 7 bytes hexdecimal command to mbed and want to see feedback on pc. The seven bytes hex command is like this, FF 01 00 04 3F 00 44. I have no idea how to write the code. I will be grateful if anyone could give advice.

Best regards

17 Nov 2012

As a starter look up serial over the USB. Use a terminal emulator and you can then type in your command string, which will be sent to the mbed. Your mbed can perform the appropriate response and send back a string to the PC which will be viewable on the terminal emulator.

Have a look at :-

http://mbed.org/handbook/SerialPC

You MUST install the driver for the PC and as I learnt it has to be done for EVERY mbed module that you use..

18 Nov 2012

Dear Kevin

Yes, I have done those steps. My problem is how to write the command string to receive the commands and display on PC.

18 Nov 2012

Hi Neil,

I think you need to investigate fprintf

http://www.cplusplus.com/reference/clibrary/cstdio/fprintf/

I use this build strings in CSV format prior to writing to disk and think it will be what you require.

19 Nov 2012

Hell Kevin,

I have finished the first step, using scanf and printf to input and show the hex commands on PC. My second step is to transmit command from pc through mbed to camera. Shall I combine the first code with "Pass through characters in both directions between the PC and Serial Port", which is shown in the serial communication with a pc?

/media/uploads/shef_eee_1/qq--20121119213238.jpg