RCX Temperature Sensor problem!!!!!

This is where you talk about the NXJ hardware related topics such as the brick, sensors, LEGO pieces, etc.

Moderators: 99jonathan, roger, imaqine

RCX Temperature Sensor problem!!!!!

Postby Mema.M » Tue Apr 19, 2011 6:17 pm

Hi :D
i'm try to program RCX Temperature Sensor to work with NXT but it is fail to work :(
when i upload the code to the NXT and execute it nothing happen at all. it terminate execution quickly.


Code: Select all
public static void main (String [] args)throws Exception
         { 
            temSensor= new TempreatureSensor(SensorPort.S4) ;
            temSensor.passivate();
            LCD.drawString("Start", 0, 4);
            float result= temSensor.getCelcius();
            LCD.drawString("Reading", 0, 5);
            String s=new Float(result).toString();
            LCD.drawString("result=", 0, 6);
            LCD.drawString(s, 0, 7);
            LCD.refresh();
               
         }

      }


any suggestions?!
Thanx in advance :o
Mema.M
New User
 
Posts: 2
Joined: Tue Apr 19, 2011 5:40 pm

Re: RCX Temperature Sensor problem!!!!!

Postby gloomyandy » Tue Apr 19, 2011 6:41 pm

Try either putting your code in a loop, or adding a Buttom.waitForPress() call at the end of your program to give you time to read the output from the code...

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

Re: RCX Temperature Sensor problem!!!!!

Postby Mema.M » Tue Apr 19, 2011 7:47 pm

Thank you

it works! :D :D :D
Mema.M
New User
 
Posts: 2
Joined: Tue Apr 19, 2011 5:40 pm


Return to NXJ Hardware

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

more stuff