Loading ...
Sorry, an error occurred while loading the content.

Re: intellibrain data transfer

Expand Messages
  • fergus
    tnx...it helps a lot...
    Message 1 of 8 , Jul 11, 2010
    • 0 Attachment
      tnx...it helps a lot...

      --- In intellibrain@yahoogroups.com, "jujames84" <jujames84@...> wrote:
      >
      >
      >
      > --- In intellibrain@yahoogroups.com, Judane James <jujames84@> wrote:
      > >
      > > Yes you can..
      > >
      >
      > ok so... to read from the COM Port you need the javax.com files (you will have to search google for them they are no longer available on sun java website...
      >
      > a simple read port class...
      >
      >
      > import java.io.InputStream;
      > import javax.comm.CommPortIdentifier;
      > import javax.comm.SerialPort;
      >
      > public class readCOM extends Thread
      > {
      > public void run()
      > {
      > CommPortIdentifier portId1;
      > InputStream inputStream;
      > SerialPort serialPort1;
      > try
      > {
      > portId1 = CommPortIdentifier.getPortIdentifier(comPort);
      > serialPort1 = (SerialPort) portId1.open("ComControl", 2000);
      > serialPort1.setSerialPortParams(9600, SerialPort.DATABITS_8, SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
      >
      > inputStream = serialPort1.getInputStream();
      > }
      > }catch(Exception e)
      > {
      > e.printStackTrace();
      > }
      > }
      >
      >
      >
      > To write create a write class...and then call the class from main by declaring it.
      >
      >
      > import java.io.OutputStream;
      > import javax.comm.CommPortIdentifier;
      > import javax.comm.SerialPort;
      >
      > public class writeCOM
      > {
      > CommPortIdentifier pid;
      > SerialPort serial;
      > java.io.OutputStream outstream;
      > String comPort = "COM5";
      > private int data;
      >
      > public void writeToPort() throws Exception
      > {
      > CommPortIdentifier pid = CommPortIdentifier.getPortIdentifier(comPort);
      > serial=(SerialPort)pid.open("WriteControl",1000);
      > serial.setSerialPortParams(9600,SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_NONE);
      > serial.setFlowControlMode(SerialPort.FLOWCONTROL_NONE);
      > outstream=serial.getOutputStream();
      >
      > }
      >
      > }
      >
      >
      >
      > Ok my write class is a little weird but if you are calling it from your main it works....
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.