Real time communication with ArduinoUNO from PC app

Hello guys,

I'm quite new to arduino, I'm basically developing a simple range finder, I have most of the things up and running, however I'm struggling with one thing:

I'd like to 'initiate' the my laser range finder through USB connected to my PC, e.g in my C++/Java app start the measurements and receive the data, is that even possible? I can imagine that I would have to develop some sort of external api on arduino for it, right?

Thanks, Szymon

I'd like to 'initiate' the my laser range finder through USB connected to my PC, e.g in my C++/Java app start the measurements and receive the data, is that even possible?

Yes, it is possible.

I can imagine that I would have to develop some sort of external api on arduino for it, right?

I think protocol (a way to exchange information in a meaningful way) is what you need, not an API. You are not going to call a function on the Arduino from the PC.

I can imagine that I would have to develop some sort of external api on arduino for it, right?

I think protocol (a way to exchange information in a meaningful way) is what you need, not an API. You are not going to call a function on the Arduino from the PC. [/quote]

To some extent I'd like to call a function, e.g. to change servo angle, switch laser on and off etc.

To some extent I'd like to call a function, e.g. to change servo angle, switch laser on and off etc.

I'm sure you would. That's just not possible. You can have a function on the PC called setServoAngle() or setDigitalPin() or whatever you like. What these functions need to do, though, is send messages to the Arduino telling it to do something. Those messages are defined in the protocol.

PaulS: I'm sure you would. That's just not possible. You can have a function on the PC called setServoAngle() or setDigitalPin() or whatever you like. What these functions need to do, though, is send messages to the Arduino telling it to do something. Those messages are defined in the protocol.

Awesome, that's what i'm looking for, could you please point me out to the 'protocol' docs/info?

could you please point me out to the 'protocol' docs/info?

That's the part you get to invent.

The mystery part for me is getting CodeBlocks C++ code on a Windoze XP PC to communicate with a COM port. It's likely I've overlooked something but I dunno what. I did download a library but damn if that doesn't want files to be in different places, so I shelved that while I work on something else that's more wanted.

Things were a lot easier before Micro$oft got in the way. I wouldn't run XP except some apps I want require it. It's one of those I need C++ to talk to Arduino, of course.

Try searching google for Firmata tutorials.

That's an awful damn lot for just wanting to use a COM port! Did they need all that to make Serial Monitor work? I doubt it.

Weird part is I have opened and configured COM3 using mode from DOS console under XP, but expect that 'hole' to be closed in later versions of Winblows. I must be not seeing something rather simple, this over-complexity just doesn't make sense.

I am interested in this topic as well. I can use Processing to talk with arduino via serial but I don't know how to open serial port with C++(which company's C++?). Any sample code would be great.

stugal: I'd like to 'initiate' the my laser range finder through USB connected to my PC, e.g in my C++/Java app start the measurements and receive the data, is that even possible? I can imagine that I would have to develop some sort of external api on arduino for it, right?

Thanks, Szymon

If you want to write a native UI in C++: Which OS (Windows, Linux, other)? Have you written UI programs for that OS before (MFC, COM, ActiveX, Gtk, Qt, other)? If you want to write your UI in Java: RXTX or alternative serial library. Are you comfortable with using the Java thread model?

You might want to also look at/consider alternatives like Web UI, Python, node.js, etc.

johncc:

stugal:
I’d like to ‘initiate’ the my laser range finder through USB connected to my PC, e.g in my C++/Java app start the measurements and receive the data, is that even possible?
I can imagine that I would have to develop some sort of external api on arduino for it, right?

Thanks,
Szymon

If you want to write a native UI in C++: Which OS (Windows, Linux, other)? Have you written UI programs for that OS before (MFC, COM, ActiveX, Gtk, Qt, other)?
If you want to write your UI in Java: RXTX or alternative serial library. Are you comfortable with using the Java thread model?

You might want to also look at/consider alternatives like Web UI, Python, node.js, etc.

I’m absolutely comfortable with Java thread model, I already found some RXTX examples, will try that out today/tomorrow.

I think that CodeBlocks allows JAVA mixed in. Maybe that will be easier.