simpleio.java

来自「Project for interfacing Parallel port of」· Java 代码 · 共 21 行

JAVA
21
字号
import parport.ParallelPort;
import javax.swing.*;

class SimpleIO {
   public static void main ( String [] Yasi ) throws InterruptedException
   {
//	 0x378 is normally the base address for the LPT1 port
      ParallelPort lpt1 = new ParallelPort(0x378); 
      int aByte;
      String input;
      do{
    	  input = JOptionPane.showInputDialog("Please, enter data to transmit");
    	  aByte = Integer.parseInt(input);
      	  lpt1.write(128);
    	  Thread.sleep(50);
    	  lpt1.write(aByte);
       	  System.out.println("Output to port: "+ aByte);
      } while (aByte != 0);
   }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?