Reading output from LEGO NXT to Arduino

I am interested in reading the direction of a motor coming for a LEGO NXT output.
What I have done thus far is plug in the white cable (or black) with a resistor into a digital pin on the Arduino and written a basic if/then statement to detect high or low.
The problem is that there is that the voltage comes out as PWM and so I get these sporatic changes going on.
So what am I trying to do?
Basically I have a solenoid with a TIP 120 transistor that I want to turn on when the motor is set to on using the LEGO mindstorms brick.
Any suggestions on how to read on off from an LEGO NXT?
Thanks
Miguel

I have never used Lego NXT but if the output is PWM, why not create a resulting DC voltage with a low pass filter and feed that to the ADC of the Arduino?
Then by reading the ADC value, you would be able to detect the level of the resulting DC voltage which is related to the PWM.
I assume that the output of the Lego will never exceed 5 volts.

The NXT and the Arduino can be made to talk over I2C. In this tutorial, we setup the Arduino as an I2C slave, and the NXT as an I2C master.

I need to read up on making a low pass filter but thanks for the idea.
The voltage can go up to 9 V depeding on the batteries you have.

And Ill look into the I2C option as well.
Thanks for your help!

Miguel