Ich habe mal die Klasse für das LCD20x4-Bricklet ein bisschen erweitert und u.a. eine kleine Laufschriftfunktion eingebaut.
Vielleicht kanns ja jemand gebrauchen
Anwendung ist relativ einfach:
public static void main(String[] args) {
IPConnection ipcon;
BrickMaster master = new BrickMaster(<UID>);
BrickletLCD20x4Advanced lcd = new BrickletLCD20x4Advanced(<UID>);
try {
ipcon = new IPConnection(host, port);
// Adding bricks to connection ...
ipcon.addDevice(master);
ipcon.addDevice(lcd);
lcd.backlightOn();
// Creates a ticker at line 0, position 0 with a step each 500
// millisecond
lcd.ticker((short) 0, (short) 0, (short) 7, (short) 500,
"Voltage on Stack");
lcd.writeLine((short) 0, (short) 7, ": " + master.getStackVoltage()
/ 1000.0 + " V");
// Creates a ticker at line 1, position 0 with a step each 750
// millisecond
lcd.ticker((short) 1, (short) 0, (short) 7, (short) 750,
"Current on Stack");
lcd.writeLine((short) 1, (short) 7, ": " + master.getStackCurrent()
/ 1000.0 + " A");
new Scanner(System.in).nextLine();
lcd.clearDisplay();
lcd.backlightOff();
ipcon.destroy();
} catch (IOException e) {
e.printStackTrace();
} catch (TimeoutException e) {
e.printStackTrace();
}
}
Happy coding
Gagahhag BrickletLCD20x4Advanced.java