Jump to content

Need some help with Callback listeners in general


riks

Recommended Posts

Hi,

I don't see any examples how to extend callback listeners or create new ones. Just an example with no meaning in Java from the documentation.

device.addExampleListener(new BrickletServoV2.ExampleListener() {
    public void property(int value) {
        System.out.println("Value: " + value);
    }
});

For the servo there a 2 OOTB examples, but I want to create my own for getCurrentPosition or current used on the servo as example. How do I implement this properly ?

Regards,
Rik

Link zu diesem Kommentar
Share on other sites

Unfortunately the Servo Bricklet only has callbacks for positionReached. You can find a complete example for it here: https://www.tinkerforge.com/en/doc/Software/Bricklets/ServoV2_Bricklet_Java.html#callback

 

If you want a Listener for getCurrentPosition you will have to call getCurrentPosition and implement a Listener-mechanism for that yourself.

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...