ColorHTSensor error negative value

This is where you talk about the NXJ software itself, installation issues, and programming talk.

Moderators: roger, imaqine, 99jonathan

jngl
New User
Posts: 6
Joined: Fri Mar 21, 2014 10:30 am

ColorHTSensor error negative value

Postby jngl » Fri Mar 21, 2014 10:49 am

Hi,

We want to use a ColorHTSensor (HiTechnic NXT Color Sensor V2) with a Lego NXT (LeJOS 0.9.1) but when we call the"initBlackLevel()" or the "initWhiteBalance()" method of this class the return value is always -3.

And when we call the "getColor().getRed()", "getColor().getGreen()" or "getColor().getBlue()" method, the return value is always -1 (probably due to init failure).

The LED turns on tho...
What can be the problem?

Thank you.

Short code sample :

Code: Select all

ColorHTSensor cs = new ColorHTSensor(SensorPort.S4); // color sensor plugged in port 4
System.out.println(cs.initBlackLevel()); // returns -3
System.out.println(cs.getColor().getRed()); // returns -1

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

Re: ColorHTSensor error negative value

Postby gloomyandy » Fri Mar 21, 2014 10:57 am

What happens if you use the color sensor sample program? Does that work with your sensor? I don't have that device so am not able to test it sorry!

jngl
New User
Posts: 6
Joined: Fri Mar 21, 2014 10:30 am

Re: ColorHTSensor error negative value

Postby jngl » Fri Mar 21, 2014 11:00 am

Hi,

Thank you for responding so quickly !

Unfortunately we were given false info on the hardware and our sensor actually is a LighSensor... Hence the error.

We'll have to get around that by ourselves


Return to “NXJ Software”

Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests