Jump to content

LCD20x4 Extension (java)


Recommended Posts

Hey, I thought I might help out. I made a class in Java that extends the LCD20x4 Bricklet allowing you to write text without having to specify the lines. I plan to add more functions to it though (word wrap etc).

 

This allows you to use all the functions of the standard class as well as the new ones.

 

Usage:

Bricklet20x4Writer LCD = new Bricklet20x4Writer("UIDHERE");
ipcon.addDevice(LCD);
LCD.clearDisplay();

LCD.writeText("The maximum this screen can hold is 80 characters anything over will be removed!");

 

EDIT: https://github.com/samvaughton/TinkerTools -> This is where I'm working on it, up to date version there.

 

Link to the class (call your class file "BrickletLCD20x4Writer.java")

 

http://pastebin.com/vZ2E728y

 

Link zu diesem Kommentar
Share on other sites

  • 3 months later...
  • 1 month later...

Hey!

 

Are you still working on the github?

I've made some extensions for the DualRealay too.

 

I've made a method that changes the state of the relay regardless if it's on or off. Usefull for a single button solution.

So say its on, you call switchState(int relayNo) relay1 switches to off. vica versa.

Nothing too fancy.

 

Got the lcd as well so i'm up to making something cool for that.

 

Haven't used github before only bitbucket.org.

So im not sure how it works, can you send me an invite to my mail anton.as@me.com?

 

Would be cool to collaborate on some extensions.

Link zu diesem Kommentar
Share on other sites

I've made some extensions for the DualRealay too.

 

I've made a method that changes the state of the relay regardless if it's on or off. Usefull for a single button solution.

So say its on, you call switchState(int relayNo) relay1 switches to off. vica versa.

Nothing too fancy.

Can you share the code here?

Link zu diesem Kommentar
Share on other sites

Sure:

package Extensions;
import com.tinkerforge.*;
import com.tinkerforge.IPConnection.TimeoutException;


public class DualRelay extends BrickletDualRelay 
{


public DualRelay(String uid)
{
	super(uid);
}

public void switchState(int relay) throws TimeoutException
{

	boolean relay1 = getState().relay1;
	boolean relay2 = getState().relay2;
	if(relay == 0)
	{
		if (relay1)
		{
			setState(false, relay2);
		} else {
			setState(true, relay2);
		}
	} else if(relay == 1)
	{
		if(relay2)
		{
			setState(relay1, false);
		} else {
			setState(relay1, true);
		}
	}
}
}

 

 

I've made a git repository for the extensions at Bitbucket.org:

https://bitbucket.org/Antonas/tinkerforge-extensions

 

If any of you want an invite, send me a PM.

Link zu diesem Kommentar
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.

Gast
Reply to this topic...

×   Du hast formatierten Text eingefügt.   Formatierung jetzt entfernen

  Only 75 emoji are allowed.

×   Dein Link wurde automatisch eingebettet.   Einbetten rückgängig machen und als Link darstellen

×   Dein vorheriger Inhalt wurde wiederhergestellt.   Clear editor

×   Du kannst Bilder nicht direkt einfügen. Lade Bilder hoch oder lade sie von einer URL.

×
×
  • Neu erstellen...