I Looked through the various arduino commands in the reference section, but I couldn't find any commands that can tell me the current state of the IO pins (analog as well as digital). Are there any? Or should I 'remember' the states myself? (Yes I am a newbie...)
Basically you should remember them but if you want to read them you will have to look at the DDR (Data Direction Register) for each port. This is outside the normal comfort zone of the Pin model used. http://www.arduino.cc/en/Reference/PortManipulation
OK, that's exactly what I was looking for. thanks.