Hitechnic Color Sensor

123 views
Skip to first unread message

john rieffel

unread,
May 17, 2011, 11:38:50 AM5/17/11
to nxt-p...@googlegroups.com, Simon D. Levy
Hi There,

I have a hiechnic color sensor that I'm trying to configure. The
following code doesn't seem to ever return a non-zero number:

myColor = Color20(myRobot,PORT_3)
print myColor.getSample()

advice?

Simon Levy

unread,
May 17, 2011, 11:54:41 AM5/17/11
to nxt-python
Hi John,

My students had the same problem with the ultrasonic sensor, and they
solved it by calling get_single_shot_measurement() instead of
getSample(). Perhaps the same thing would work for the color sensor.
There is also a get_sample() method in the superclasses for these
sensors, so you might try that.

Best,
Simon

john rieffel

unread,
May 17, 2011, 12:33:47 PM5/17/11
to nxt-p...@googlegroups.com
eer, i meant get_sample. which doesn't return non-zero

I'll try get_single_shot_measurement()

> --
> You received this message because you are subscribed to the Google Groups "nxt-python" group.
> To post to this group, send email to nxt-p...@googlegroups.com.
> To unsubscribe from this group, send email to nxt-python+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/nxt-python?hl=en.
>
>

john rieffel

unread,
May 17, 2011, 12:38:29 PM5/17/11
to nxt-p...@googlegroups.com, Simon D. Levy
follow up: I was able to get values from the following code:

from nxt.sensor.hitechnic import *
myColorSensor = Colorv2(myRobot,PORT_4)
val = myColorSensor.get_sample()
print val.red, val.blue, val.green

is this the best way to go about it?

Marcus Wanner

unread,
May 17, 2011, 12:40:32 PM5/17/11
to nxt-p...@googlegroups.com

Try HTColorv2...Color20 is the NXT 2.0 official color sensor.

Didn't it warn that you were using the wrong sensor?

--
Marcus Wanner

signature.asc

Rochan Avlur

unread,
Mar 22, 2013, 5:53:05 AM3/22/13
to nxt-p...@googlegroups.com, Simon D. Levy
hi, 

I did the same but where ever I keep it , I always get : 1

Thanx
Reply all
Reply to author
Forward
0 new messages