Re: Read from a device connected through serial port
Jac Kersing <j.kersing-9+7/[email protected]>
| Newsgroups | gmane.comp.hardware.microcontrollers.tini |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 12 May 2004, Fabian Lopez Coloma wrote: > The motor sends as a response a String to Tini and I would like to read this > answer and print it out. How can I do this? sin.read(...) only returns an > integer, but not the data that motor sends me. int InputStream.read(byte[] buffer) returns the number of bytes read, the data is stored in buffer. int InputStream.read() returns a single byte of from the input. If the response is multiple bytes you'll probably want to use the version with a byte buffer as generaly it's faster (one call for multiple bytes.) BTW. The method information (including the three parameter read) can be found in the JavaDocs of InputStream that is included in the J2SDK distribution. Regards, Jac -- Jac Kersing Technical Consultant The-Box Development j.kersing-9+7/[email protected] http://www.the-box.com _______________________________________________ TINI mailing list TINI-6tN4nzCoH/[email protected] To UNSUBSCRIBE, edit your profile, or see list archives: http://lists.dalsemi.com/mailman/listinfo/tini