Go Down

Topic: Can I read/write data througth usb?What language is the best? (Read 1 time) previous topic - next topic

Phate867

Hi there, I know we can send/receive data throught usb with Serial.write and read, but this data just stay in arduino IDE and I don't like it...I'd like to build my own program for PC and make it communicate with my arduino board.

So, is it possible?What language is better?I'd prefer going with java or c# but I've no problems doing it in c++ or other...just point me out to some simple tutorial, as I don't know how to communicate with an usb peripheral in the first place :( (in arduino I just keep doing Serial.write and stuff, right?)

dxw00d

#1
Jun 11, 2012, 12:42 pm Last Edit: Jun 11, 2012, 12:47 pm by dxw00d Reason: 1
You don't have to communicate directly with a usb device. The Arduino appears as a virtual serial port, and you communicate with that. Processing (http://processing.org) is Java based, free, uses basically the same IDE as the Arduino software, and provides examples for communicating with Arduino. Whether it's best depends on what you actually want to do. If you want to write something with a fancy GUI, then Visual C# or Visual Basic might be a better option, assuming you are on Windows.

Phate867

#2
Jun 11, 2012, 12:47 pm Last Edit: Jun 11, 2012, 12:51 pm by Phate867 Reason: 1
Mh...I'd like to use a more "standard" language, so I can use code snippets I already have, avoid learning other languages and make my application more portable...isn't there a "pure java" way?

dxw00d

Provided 'Pure Java' can access a serial port, then you should be fine.

What level of portability do you need. One of Processing's advantages is that it runs on OS X, Linux and Windows, and you can produce standalone apps for all three platforms regardless of your development platform.

PaulS

Quote
isn't there a "pure java" way?

Look at the playground. There is a whole section on interfacing with software. Pick a language/mechanism that you are familiar with.

http://arduino.cc/playground/Main/InterfacingWithSoftware

Phate867

Pure java is fine as pretty every os has a jvm installed on! :D
Could you point me to some "interact with virtual serial port" tutorial you think is useful, please?

Edit:
thanks Paul this was just what I needed! ;) http://arduino.cc/playground/Interfacing/Java

dxw00d

Quote
Pure java is fine as pretty every os has a jvm installed on!


If only life was really that simple, instead of the reality of 'every os may/may not have one, or more, of a set of not quite compatible jvms installed'.

Go Up