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

×
×
  • Create New...