Need help reading I/O ports

Hi,

I’m a real novice to all this. Can anyone give me a simple code to get information from the Sharp gp2d12 sensors? I just need to be able to setup the port for input and to read in the values so I can use them.

Thanks

well, you can start by looking at the general purpose I/O section of the datasheet for your MCU. Reading from a port is pretty easy: you need to set the port direction so that the pins you’re interested in are input pins. Then you may simply read from that port register as needed. If you post more information (MCU, pins you’re using, etc) I can probably help you more with the code but it’s very simple if you look at the datasheet.