This is where you talk about the NXJ hardware related topics such as the brick, sensors, LEGO pieces, etc
Moderators: roger, 99jonathan, imaqine
by Mema.M » Tue Apr 19, 2011 6:17 pm
Hi
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

-
Mema.M
- New User
-
- Posts: 2
- Joined: Tue Apr 19, 2011 5:40 pm
by 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
-

gloomyandy
- leJOS Team Member
-
- Posts: 3004
- Joined: Fri Sep 28, 2007 2:06 pm
- Location: UK
by Mema.M » Tue Apr 19, 2011 7:47 pm
-
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: No registered users and 1 guest