mattallen37 wrote:Lego uses pin 5 as a logic IO pin (such as to turn on the light on the light sensor). Pin 1 is the analog pin, but it can be driven high (supply voltage). Lego does some nonstandard things that really don't make sense.
A little more information...
The power supplied to pin 1 has three possible states...
1. Pulsed 9V the pin is driven to 9V for approx 3mS then allowed to float to the 5V pull up for approx 0.1mS during which time an analogue reading is taken.
2. The pin is driven at 9V all of the time (but the analogue reading still happens 333 times a second).
3. The pin is pulled up to 5V constantly and again read 333 times a second.
Although this may seem a little odd, Lego had good reason to do it to allow compatibility with the old RCX sensors.
Pin 6 as well as being a digital output pin can also be used as an analogue input pin (but this is read by the NXT Arm chip rather than the ATmega which reads pin 1). This pin can be sampled by the firmware at a much higher sample rate, and is currently used to read data from the Lego color sensor