Question:
can nebody help us with java code for controlling LEDs through parallel port?
anonymous
1970-01-01 00:00:00 UTC
can nebody help us with java code for controlling LEDs through parallel port?
Three answers:
anonymous
2016-11-03 13:43:58 UTC
Linux makes gadget drivers much less stressful, yet you apart from mght want domicile windows. There are reminiscence mappers to seize indicators and handle values. In Linux you have report get admission to on your hardware. as quickly as you already know those information you are able to write the driving force for the two platform. You do it in C.
anonymous
2016-06-23 00:30:29 UTC
Parallel Port Programming In Java
Ciaron
2010-01-06 05:23:06 UTC
I have seen parallel port programming in several languages,most of the programming I have seen is for old MS-DoS application though Visual Basic did support Parrallel and Serial port ports what you need to know is which pins you need to connect to the LED's

The registers found in standard parallel port are ,



1) data register

2) Status register

3) Control register

In Java there is the "Java Comm. API" then there is the abstract class CommPort which has two subclasses SerialPort and ParrallelPort which should have the information you are needing for parallel port controls

Here is an example of a Java program I found online that should point you in the right direction

import javax.comm.*;

import javax.comm.ParallelPort;

import java.util.*;

import java.lang.*;

import java.io.*;



public class TestApp

{

static CommPortIdentifier CPIone;

static Enumeration Eone;

static ParallelPort Pone;

static OutputStream OSone;

static DataOutputStream DOSone;

public static void main (String arg[])

{

Eone=CommPortIdentifier.getPortIdentifiers();

while(Eone.hasMoreElements())

{

CPIone=(CommPortIdentifier)Eone.nextElement();

if((CPIone.getPortType()==CommPortIdentifier.PORT_PARALLEL)&&((CPIone.getName()).compareTo("LPT1")==0))

{

try

{

Pone=(ParallelPort)CPIone.open("TestApp",3000);

}catch(PortInUseException e){}

System.out.println(CPIone.getCurrentOwner());



System.out.println(Pone.getMode());

System.out.println(CPIone.getPortType());

try

{

Pone.setMode(1);

}catch(UnsupportedCommOperationException e)

{

System.out.println("Unsupported byte mode.");

}

System.out.println("unidirectional");

}

}

try

{

OSone=Pone.getOutputStream();

DOSone = new DataOutputStream(OSone);



/*where to send the data to the printer port */

DOSone.writeByte(0x90); ------- Statement 1

System.out.println("Hello"); ------Statement 2

}

catch(IOException e)

{

System.out.println("Error has occured");

e.printStackTrace();

}

}

}





It's not exactly what you are looking for but it can be easily adapted.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...