Can I control what does the mbed from an API running on my computer ?

Hello everyone,

I would like to control the mbed from an API on my computer. For example, I am on my laptop, and I want to switch on the LED connected on pin 15. Then may be I would like to diminish the brightness of this LED and switch on the one on pin 16.

For now I only know I can write a program in c++, compile it with the compiler of the website, put my program into the mbed and hit the reset button.

But if on the mbed I create a program for each led I want to switch on or off, can I call those programs whenever I want from my coputer ? Basically I would like to control the mbed directly from my computer.

How (if it is possible) can you communicate with the mbed from an API you are running on your computer ?

Or should I use a PIC with USB interface instead ?

Thank you very much.

21 May 2012

Pierre -

There is no general way to do this that is already provided, but you could create one and then contribute it back to the community!

An easy thing to do is to use scanf or getchar to read keystrokes from a terminal program connected to the MBED virtual COM port. This would give you a command-line interface to operate the MBED from your PC.

21 May 2012

It sounds like you might want to look at the RPC functionality http://mbed.org/cookbook/Interfacing-Using-RPC.

That should allow you to send commands from a connected device like a computer to turn LEDs on and off and a number of other things, although I haven't tried it myself.

21 May 2012

Thanks for posting this, Richard!

Serves me right for not checking first.

Thank you for the answer !

Actually I was already using the RPC to command the LEDs, the part I didn't know about was the terminal part, where you can give orders to the MBED from your computer.

I'd like to ask a new question if you don't mind, I am actually controlling the brightness of LEDs on the pins of the MBED from the terminal (using tera term) but can I do the same by creating a graphic interface ? So when I hit the reset button on the MBED a window appear on my computer and ask me through a graphic interface which LED I want to switch on/off its brightness etc ...

I still am a beginner on programming and the GUI isn't the first thing you learn about ^^

Thank you very much for your time.

23 May 2012

You could either create a native Windows (or Mac or Linux) graphical program that uses RPC to control the MBED, or you could create a web browser application with Javascript that uses RPC to control the MBED.

It won't be easy, since you are not experienced with it. I suggest you look for development tools that have some example projects that demonstrate sliders and knobs and other UI widgets. You just take an example project and modify it to make your RPC calls.

Thanks for your dedication Mr Bracey, I'll first right the API and then try to find a simple example of project I can use.