Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #19298 > unrolled thread
| Started by | sahm <sahm007@gmail.com> |
|---|---|
| First post | 2012-10-13 12:54 -0700 |
| Last post | 2012-10-15 11:24 -0700 |
| Articles | 6 — 6 participants |
Back to article view | Back to comp.lang.java.programmer
I need to write Simple JAVA program to read and write from USB serial to use it with Arduino sahm <sahm007@gmail.com> - 2012-10-13 12:54 -0700
Re: I need to write Simple JAVA program to read and write from USB serial to use it with Arduino Lew <lewbloch@gmail.com> - 2012-10-13 13:07 -0700
Re: I need to write Simple JAVA program to read and write from USB serial to use it with Arduino Arne Vajhoej <arne@vajhoej.dk> - 2012-10-13 19:00 -0400
Re: I need to write Simple JAVA program to read and write from USB serial to use it with Arduino Martin Gregorie <martin@address-in-sig.invalid> - 2012-10-14 00:02 +0000
Re: I need to write Simple JAVA program to read and write from USB serial to use it with Arduino Knute Johnson <nospam@knutejohnson.com> - 2012-10-13 17:30 -0700
Re: I need to write Simple JAVA program to read and write from USB serial to use it with Arduino stledger@lanl.gov - 2012-10-15 11:24 -0700
| From | sahm <sahm007@gmail.com> |
|---|---|
| Date | 2012-10-13 12:54 -0700 |
| Subject | I need to write Simple JAVA program to read and write from USB serial to use it with Arduino |
| Message-ID | <ba723146-04af-433c-9b5b-8ca39828039f@googlegroups.com> |
Hi every one I’m trying to write simple JAVA program that could send command to Arduino board or read output from Arduino. I tried java-simple-serial-connector library but I keep getting error. And in Arduino web site they use gnu.io. classpath witch I have no idea how to use it with java Please help me Best Salim
[toc] | [next] | [standalone]
| From | Lew <lewbloch@gmail.com> |
|---|---|
| Date | 2012-10-13 13:07 -0700 |
| Message-ID | <8aeb4c0e-53ad-4bf3-afa3-d2ac769b8cbf@googlegroups.com> |
| In reply to | #19298 |
sahm wrote: > I’m trying to write simple JAVA [sic] program that could send command to > Arduino board or read output from Arduino. > I tried java-simple-serial-connector library but I keep getting error. > And in Arduino web site they use gnu.io. classpath It's not a classpath. > witch I have no idea how to use it with java [sic] I can answer only part of this. To use any library with a Java program, typically one has that library in the form of a JAR file (file with name ending in ".jar", in ZIP file format and possessing certain contents; GIYF) that one includes in the classpath (GIYF). There are also language requirements to using libraries involving the 'import' directive. (TIYF: The Tutorial is Your Friend.) Download the library you need and include it in your classpath. Follow up here with the specific commands you use, exactly how you use them, and copied and pasted output if you need further help. Make sure you do the suggested research first. -- Lew
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhoej <arne@vajhoej.dk> |
|---|---|
| Date | 2012-10-13 19:00 -0400 |
| Message-ID | <5079f282$0$294$14726298@news.sunsite.dk> |
| In reply to | #19298 |
On 10/13/2012 3:54 PM, sahm wrote: > I’m trying to write simple JAVA program that could send command to Arduino board or read output from Arduino. > I tried java-simple-serial-connector library but I keep getting error. > And in Arduino web site they use gnu.io. classpath witch I have no idea how to use it with java Serial port support has not been a priority in Java. I believe the most common recommendation is to go for rxtx. Arne
[toc] | [prev] | [next] | [standalone]
| From | Martin Gregorie <martin@address-in-sig.invalid> |
|---|---|
| Date | 2012-10-14 00:02 +0000 |
| Message-ID | <k5cvfb$682$1@localhost.localdomain> |
| In reply to | #19298 |
On Sat, 13 Oct 2012 12:54:48 -0700, sahm wrote: > Hi every one > > I’m trying to write simple JAVA program that could send command to > Arduino board or read output from Arduino. > I tried java-simple-serial-connector library but I keep getting error. > And in Arduino web site they use gnu.io. classpath witch I have no idea > how to use it with java > > Please help me > You can't drive a serial connection from Linux/OS X/Windows using pure Java. SimpleSerial, RxTx or my SerialPort package all use C in various ways to build a bridge between the Java program and the serial port. This code is *always* compiled for the target operating system: it has hopefully been written to be portable but its always possible that it wasn't, or at least has never been ported to the version of the OS you're using. I think SimpleSerial and RxTx both use the JNI interface to their C code modules. My package uses a socket connection from the Java program to a separate server, written in GNU C, that drives the serial port(s) and that has only been compiled & tested under Linux. As far as I know all three were designed to work with built-in serial ports. I'd expect Linux or OS X to be capable of transparently driving a USB-serial adapter[1]. I don't use Windows so can't tell you about it. In any case, you still need some form of C glue because Java doesn't have any knowledge of USB-serial adapters. However, there are other approaches that are worth a look. These all use the fact that Java can handle socket connections: - use an Arduino board with an Ethernet interface and an onboard TCP/IP software stack. Something like these: http://www.amazon.com/Arduino-Ethernet-Power-over-Ethernet-Serial- Adapter/dp/B005EJN5X6 http://arduino.cc/en/Main/ArduinoBoardEthernet - You can buy relatively inexpensive modules that take an Ethernet connection (RJ-45) socket and provide an RS-232 serial connection for your Arduino board. These are what I mean: http://gridconnect.com/network-components/xport.html http://kanda.com/products/Sena/NEMO10.html http://www.radi.com/modular64.htm - or you can get back-to-back sockets (Ethernet (RJ45) one side, RS-232 (D9) the other): http://microcontrollershop.com/product_info.php? cPath=98_284&products_id=1459 [1] maybe. There are USB-serial adapters and USB-serial adapters: some will 'just work' with Linux and some won't. If the adapter needs a driver to work under Windows, then that's possibly also a trial and error game. I have a pFranc USB-serial adapter that works like a charm with native Linux programs but refused point blank to work with a Windows program running on Linux under Wine. Go figure. -- martin@ | Martin Gregorie gregorie. | Essex, UK org |
[toc] | [prev] | [next] | [standalone]
| From | Knute Johnson <nospam@knutejohnson.com> |
|---|---|
| Date | 2012-10-13 17:30 -0700 |
| Message-ID | <k5d12j$8nh$1@dont-email.me> |
| In reply to | #19298 |
On 10/13/2012 12:54 PM, sahm wrote: > Hi every one > > I’m trying to write simple JAVA program that could send command to Arduino board or read output from Arduino. > I tried java-simple-serial-connector library but I keep getting error. > And in Arduino web site they use gnu.io. classpath witch I have no idea how to use it with java > > Please help me > > Best > Salim > On Windows, if you only need to read and write, you can do that with the COM? port. If you need access to the serial data lines you need to find an old copy of the JavaComm API. I'm using it with Windows XP, I think it would work with Vista or 7 but I've never tried it. It is no longer supported by Oracle(Sun) but you can find it if you snoop around. Last time I checked, there was still a version available from Sun for Linux I think. I tried RXTX once but it was too buggy to use and there was no interest in fixing it. -- Knute Johnson
[toc] | [prev] | [next] | [standalone]
| From | stledger@lanl.gov |
|---|---|
| Date | 2012-10-15 11:24 -0700 |
| Message-ID | <51fa3ce7-8e4d-4713-8a9a-6ed784abd2e2@googlegroups.com> |
| In reply to | #19298 |
On Saturday, October 13, 2012 1:54:48 PM UTC-6, sahm wrote: > Hi every one I’m trying to write simple JAVA program that could send command to Arduino board or read output from Arduino. I tried java-simple-serial-connector library but I keep getting error. And in Arduino web site they use gnu.io. classpath witch I have no idea how to use it with java Please help me Best Salim We have had good success with SerialPort from SerialIO.com. It has worked well for a several different serial devices. John
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web