Sensor question

So I i am a bit confused, I have been messing around with electronics for many years but I haven’t done much in this depth yet. I was wondering, if I have a photoresitor or thermoresitor, just the raw component and I want the botboard to read these values how would I go about it? I guess you can connect them directly to the input pins and read the analog value? Is there a tutorial or something I could read about this, or could someone show me a diagram and sample code? Thank you for all the help you guys have been giving me!

You can’t just connect a photocell or thermistor to an analog input. The analog input is designed to read a voltage. In order to convert this variable resistance to a voltage you make a voltage divider from a fixed resistor and the variable one. For example look at these.

lynxmotion.com/images/html/build129.htm

lynxmotion.com/images/html/build127.htm

WOW! That was really easy… thank you, I don’t know why I didn’t see those, I really did look for some diagrams :mrgreen:

I can’t believe it worked on the first try and it only took this amount of code…

[code]
light_int var word

main

adin P16,light_int

serout s_out,I9600,[REAL light_int, 13]

goto main[/code]

Thank you again!

Win!!! You’re welcome. 8)