Arduino + nxt light sensor

im trying to get the arduino to read a value comming in from the light and color sensor from my lego NXT kit.
any suggestions?

Strip the NXT cable & connect the white wire (analog) to the arduino analog.

pin1 - ANA (white)
pin2 - GND (red)
pin3 - GND (black)
pin4 - VCC (green)
pin5 - Dig0 (blue)
pin6 - Dig1 (yellow)

See PDF for Light Sensor schematic,

if i plug the sensor into the arduino then my computor doesnt recognize the arduino fro some reason

Are you sharing GND & VCC between the sensor and the arduino ?

Be careful to check your voltages. You most likely need 3.3V to the light sensor instead of 5V.

what is vccshould i be hooking up black geen adn white or black red and white cause ive been using red in the 3v3 white in pin 0 and black in gndhere is the code using

void setup() {
  Serial.begin(9600);
}

void loop() {
  Serial.println(analogRead(0));
  delay(10);
}

okay i gt a reading but its only zeros and an occasional 1 i did this by hooking up black to gnd green to 3v3 and white to analog 0

and my computer is still recognizing the arduino so far so good now i just need the arduino to give me a wider range of values comming from the sensor any mor suggestions

okay so i have the sensor working with the following white-analog 0 red/black-gnd yellow/green-3v3 i just have one last question: how would i make an average of the input comming in from the sensor

  1. You can make an array of 5 - 10 values depending how much you want to average.

  2. save your analog values in a for loop while indexing into the array.

  3. Get an average of your array.

This is a really simple approach, for more detailed approaches check out moving average filters, Moving average - Wikipedia

have you ever hooked up any nxt sensors to the arduino? if so am i just supposed to be getting 1's and 0's? cause thats what im getting