X-Git-Url: http://git.megacz.com/?p=eltron.git;a=blobdiff_plain;f=src%2Fcom%2Fmegacz%2Feltron%2FEltron.java;h=d59e73c6725bcb2187d250924d5328b0c497d639;hp=33c090b18a23f0b56f415182fff5e76aecfbfe52;hb=92cee80407f72b94511743bb0bb4df19af8c9e5c;hpb=61e6074f12446ccf9f6b5a41996e3c8b8f8e2f3a diff --git a/src/com/megacz/eltron/Eltron.java b/src/com/megacz/eltron/Eltron.java index 33c090b..d59e73c 100644 --- a/src/com/megacz/eltron/Eltron.java +++ b/src/com/megacz/eltron/Eltron.java @@ -6,12 +6,30 @@ import java.io.*; import java.util.*; import gnu.io.*; +/* + +If you're on a mac and you get the error below, you need to create +/var/lock and make it writable. + +Exception in thread "main" gnu.io.PortInUseException: No such file or directory in open +at gnu.io.RXTXPort.open(Native Method) +at gnu.io.RXTXPort.(RXTXPort.java:84) +at com.megacz.eltron.Eltron.detectPort(Eltron.java:26) +at com.megacz.eltron.Eltron.print(Eltron.java:37) +at com.megacz.eltron.Eltron.main(Eltron.java:14) + + + */ + /** code to control an Eltron */ public class Eltron { public static void main(String[] s) throws Exception { Picture p = new Picture(System.in); print(p.data, p.width, p.height); + + // RXTX spawns a thread that never dies + System.exit(0); } public static SerialPort detectPort() throws Exception { @@ -35,8 +53,11 @@ public class Eltron { // you'll need to run this once at 9600 to tell the built-in eeprom to switch to 38,400kbps //sp.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); + + sp.setSerialPortParams(38400, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE); + OutputStream out = sp.getOutputStream(); InputStream in = sp.getInputStream(); int count = 0;