Jump to content

[Java] LCD20x4 - Kleine Laufschrift


Recommended Posts

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  :D

 

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...