Touch Sensor

Post your NXJ projects, project ideas, etc here!

Moderators: imaqine, 99jonathan, roger

Posts: 48
Joined: Tue Mar 02, 2010 11:22 pm

Touch Sensor

Postby win1for » Fri Mar 26, 2010 12:14 pm

How can i write a listener for the TouchSensor.

How do i implement the stateChenged() method. When the touch sensor is pressed what value does it return.


User avatar
leJOS Team Member
Posts: 5972
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Postby gloomyandy » Fri Mar 26, 2010 12:21 pm

Why don't you try it and see what happens...

Posts: 48
Joined: Tue Mar 02, 2010 11:22 pm

Postby win1for » Fri Mar 26, 2010 12:32 pm

Thanks for your reply.

Infact am just a beginner in robot programming and have no clue how the Touchsensors are implemented. I have to show in my GUI(PC application) the status of the TouchSensor anytime it is pressed or released.

I have read the leJOS tutorials but there is no example there. I don't even know if writing the listerner will help. I just don't know what should go inside the stateChanged() method.

please if you know a tutorial then kindly point me there.

Do i have to declare a TouchSensor class in the GUI side also to test whether it is pressed or released?

I need explanation how it is done and i will do it myself. i just need explanation what must be done in the client side(GUI) and what should be done in the robot side and i will start from there to continue.


Return to “NXJ Projects”

Who is online

Users browsing this forum: No registered users and 3 guests