LCDOutputStream is used for writing data to a LCD Display.
This class can be used for direct writing to the LCD display on the TINI.
It has been tested with LCDs that use the Samsung
KS0066U and KS0070B segment drivers. Using this stream, you can create
a PrintStream and do println()s to the display. Each println will show
up as the next available line on the display.
Data Sheets
Samsung
KS0070B Datasheet
KS0066U Datasheet
Example Usuage
PrintStream out = null;
try
{
out = new PrintStream(lp.getOutputStream());
}
catch (IOException e)
{
System.out.println(e);
}
LCDPort.setAddress(0x40); // set the address
out.println("HELLO"); // write Hello to the LCD
Constructor Summary |
LCDOutputStream(LCDPort lcd)
Creates a new data output stream to write data to the LCD port. |
Method Summary |
void |
close()
Closes this output stream and releases any system resources
associated with this stream. |
void |
write(byte[] barr,
int offset,
int len)
Displays the array on the LCD display. |
void |
write(int ch)
Writes the given character to the LCD display. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
LCDOutputStream
public LCDOutputStream(LCDPort lcd)
- Creates a new data output stream to write data to the LCD port.
- Parameters:
lcd
- the LCD port to use for communications
write
public void write(int ch)
throws IOException
- Writes the given character to the LCD display. This method blocks until
the byte has actually been sent.
- Overrides:
- write in class OutputStream
- Parameters:
ch
- the byte to write to the display- Throws:
- IOException - if port is not open
write
public void write(byte[] barr,
int offset,
int len)
throws IOException
- Displays the array on the LCD display. This method blocks until all bytes
have been sent.
- Overrides:
- write in class OutputStream
- Parameters:
barr
- the array to sendoffset
- the offset into the array to begin sendinglen
- the number of bytes to send- Throws:
- IOException - if port is not open
close
public void close()
throws IOException
- Closes this output stream and releases any system resources
associated with this stream. Calls the underlying LCDPort close method.
- Overrides:
- close in class OutputStream
- Throws:
- IOException - if port is not open