Java/Comunicazione seriale: differenze tra le versioni

Contenuto cancellato Contenuto aggiunto
sintassi colorata
fix (modifico a sezioni
Riga 116:
import javax.comm.*;
import java.util.*;
...<br>
//
// Platform specific port name, here a Unix name
Riga 126:
// port, but instead make it user configurable.
//
String wantedPortName = "/dev/ttya";<br>
//
// Get an enumeration of all ports known to JavaComm
//
Enumeration portIdentifiers = CommPortIdentifier.getPortIdentifiers();<br>
//
// Check each port identifier if
Riga 151:
System.err.println("Could not find serial port " + wantedPortName);
System.exit(1);
}<br>
//
// Use port identifier for acquiring the port
Riga 248:
* Explain how to mix binary and character I/O over the same stream
* Fix the example to use streams}}
<source lang=comm>
--[[utente:Wim_b|Wim b]]-[[discussioni utente:Wim_b|talk]] 13:39, 30 lug 2007 (CEST)
// Write to the output
os.print("AT");
Riga 255:
is.readLine(); // First read will contain the echoed command you sent to it. In this case: "AT"
is.readLine(); // Second read will remove the extra line feed that AT generates as output
</source>
 
==== Simple Reading of Data (Polling) ====