Page 1 of 1

Java source code

Posted: Thu Apr 21, 2005 6:49 am
by Spamzor
I have already emailed MO support about this, and I was emailed some C source code - useless

the java source file linked in the thread above is DEAD.

I have searched for hours and I need someone to help!!!

Posted: Fri Apr 22, 2005 8:38 pm
by Spamzor
Common, can someone supply me with some Java source code or not?

Posted: Mon Apr 25, 2005 7:23 am
by Miles
Hi Spamzor,

Can you please contact me at myero@matrixorbital.ca and I'll see what I can find and send it to you ASAP. I apologize for the delay... :(

Posted: Sat Apr 30, 2005 8:53 am
by Spamzor
Miles wrote:Hi Spamzor,

Can you please contact me at myero@matrixorbital.ca and I'll see what I can find and send it to you ASAP. I apologize for the delay... :(
I emailed you and I got an email back telling me to look at the javelin source,

that does not help!

I am not programming through javelin??

Posted: Thu May 12, 2005 2:20 pm
by Tom
Hi Spamzor,

Sorry for any late replies. I had to look all over for a java sample. Here it is below. This program will take keypad inputs and display them on the LCD.

/**
* LCDControl.java
*
* Author: Owen Langman (langman@cs.wisc.edu)
*
* Description:
* Basic commands to control a Matrix Orbital (we love MO!)
* LCD screen.
*
* NOTE: This requires the javax.comm package.
* Check java.sun.com
**/

import java.io.*;
import java.util.*;
import javax.comm.*;

/**
* Collection of methods to control a Matrix Orbital LCD.
*
* <p> Bugs: None known.
*
* @author Owen Langman (langman@cs.wisc.edu)
*
**/
public class LCDControl {

private CommPortIdentifier portId;
private SerialPort serialPort;
private OutputStream outputStream;

public static final char COMMAND_START = (char)254;
public static final char COMMAND_NULL = (char)0;
public static final char COMMAND_ETX = (char)3;
public static final char COMMAND_DEL = (char)253;

/**
* Constructor. Uses COM1 as the default port.
*
**/
public LCDControl() {
this(1); //uses com1 with default const.
}

/**
* Constructor. Initializes COM port and resets the LCD.
*
* @param port Interger specifying the COM port to output to.
**/
public LCDControl(int port) {

String portname = new String("COM");
portname += port;
try {
portId = CommPortIdentifier.getPortIdentifier(portname);
} catch (NoSuchPortException ex) {
System.out.println(portname + " does not exist.");
return;
}

try {
serialPort = (SerialPort)portId.open("LCDControl",2000);
} catch (PortInUseException ex) {
System.out.println("Could not open " + portname);
return;
}

try {
serialPort.setSerialPortParams(19200,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
} catch (UnsupportedCommOperationException ex) {
System.out.println("Could not set serial stuff");
}

try {
outputStream = serialPort.getOutputStream();
} catch (IOException e) {}

resetLCD();
}

/**
* Resets the lcd in every way possible.
*/
public void resetLCD() {

String resetString;
resetString = new String(COMMAND_START + "B" + COMMAND_NULL +
COMMAND_START + "~" + COMMAND_NULL + COMMAND_START +
"T" + COMMAND_START + "Y" + COMMAND_ETX +
COMMAND_START + "X");
try {
outputStream.write(resetString.getBytes());
} catch (Exception ex) {
System.out.println("Could not reset lcd");
}
}

/**
* Clears the LCD screen.
*/
public void clear() {

String clearString;
clearString = new String(COMMAND_START + "X");
try {
outputStream.write(clearString.getBytes());
} catch (Exception ex) {
System.out.println("Could not clear lcd");
}
}

/**
* Writes a string to the screen at the cursor's current
* position.
*
* @param str String to write to the screen.
*/
public void display_write(String str) {

try {
outputStream.write(str.getBytes());
} catch (Exception ex) {
System.out.println("Could not write to lcd");
}

}

/**
* Changes position of the lcd's cursor.
*
* @param x Horizontal index to move the cursor to
* @param y Line number to move the cursor to
*/
public void display_position(int x, int y) {

String displayString;
displayString = new String(COMMAND_START + "G");

try {
outputStream.write(displayString.getBytes());
outputStream.write(y);
outputStream.write(x);
} catch (Exception ex) {
System.out.println("Could not change cursor position on lcd");
}
}

/**
* Full clear then shutdown of the LCD
*/
public void display_close() {

String clearString, closeString;
clearString = new String(COMMAND_START + "X");
closeString = new String(COMMAND_START + "F");

try {
outputStream.write(clearString.getBytes());
outputStream.write(closeString.getBytes());
} catch (Exception ex) {
System.out.println("Could not close lcd");
}
}
}

Re: Java source code

Posted: Thu Jan 10, 2013 1:07 pm
by Tharos
Hi!
I'm looking for an example that send and receive commands or text from the LCD on JAVA but in Linux.
Can anybody help me?

Thanks!

Re: Java source code

Posted: Thu Jan 10, 2013 2:11 pm
by Clark
Hi Tharos,

Unfortunately, with so many programming languages and operating systems we don't have a demo for absolutely everything. I would recommend taking a look at our Linux Appnote to determine how to communicate to the display in a Linux environment, and then changing the required methods in the code above over to Linux.

Thanks,
Troy

Re: Java source code

Posted: Wed Jan 16, 2013 11:52 am
by Tharos
Thanks for your answers Clark!

Re: Java source code

Posted: Wed Jan 16, 2013 10:08 pm
by Clark
My pleasure Tharos,

Once you do have your code up and running, don't hesitate to post a little snippet to guide fellow developers. And if you do have any questions, just ask.

Thanks,
Troy

GLK Java API

Posted: Thu Jul 11, 2013 9:34 am
by Dave Osborne
We developed a Java API for use with the GLK19264-7T-1U, which we've then used with a product running on Linux.
The API is now a public repo on github, and we'd like to see if other users out there find it useful, and hopefully want to contribute to refining and expanding the API. You can find it at github.com/daveosborne66/lcd

Re: Java source code

Posted: Thu Jul 11, 2013 10:17 am
by Clark
Hi Dave,

Your contribution is greatly appreciated; the code appears extensive and well written, an amazing resource for anyone starting Matrix Orbital development in Java.

If possible, we'd love to add an entry for your products in our gallery section, if you have any info/images we could use please shoot me an email.

Thanks again,
Troy