Touch And Color Sensors

Post your NXJ projects, project ideas, etc here!

Moderators: imaqine, 99jonathan, roger

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

Touch And Color Sensors

Postby win1for » Thu Mar 25, 2010 5:01 pm


I want a label in my GUI to show pressed or released anytime i press or release the touch sensor. My problem now is how should i write the code on the robot side to send to the GUI. the same applies to the color sensor.

I have search the examples that comes with leJOS but the touch and color sensor examples are for the client side(GUI) and not on the robot.

I am looking for the codes on the robot side that will send the status of the touch sensor and the color sensor to the GUI.

My second problem is that how can i open the connnection to the robot continuously and exchange messages with the GUI until i close the connection at the end of the communication.

I am finding it hard how to make the connection stay. i learnt when you open a connection with the robot, it blocks and waits until something is send to it.
I used on the side of the robot,

Code: Select all


but i have to close the streams otherwise when i run the GUI, i get exceptions on the robot. Because the stream is closed i can't access the touch and color sensors.

please i need help how to get it done.

thanks for your help[/code]

New User
Posts: 19
Joined: Tue Sep 22, 2009 3:44 am

Postby SpikeT » Thu Apr 01, 2010 4:06 pm

Have you check at BTSend in PCsamples and BTReceive in Samples?
I should answer you question pretty well. You still nee to find the way
to how to manage your data though.

I adopt those examples and create a program for controlling a NXT
from PC. That may help you find some idea.

Here is the link

Return to “NXJ Projects”

Who is online

Users browsing this forum: No registered users and 2 guests