Vdd (+5 volts) ---(Photo Resistor)--- InputPin ----- 2kOhm Resistor ---- Vss
Sorry for the crude schematic - is there a better way to input these? At any rate, the provided configuration is tuned to trigger the input at 1.4v which is appropriate for a BASIC stamp. I'd like to modify the circuit for use with the Netduino. I tried using the circuit verbatim with the Netduino analong input pins but it appears to output a static value. What's a good way to wire this up with Netduino?
Code used to read the analog pin:
AnalogInput photo = new AnalogInput(Pins.GPIO_PIN_A1); while (true) { Thread.Sleep(200); var light = photo.Read(); Debug.Print(DateTime.Now + " " + light.ToString()); }
PS - The analog project tutorials would be very helpful for figuring out this sort of issue