unreliable inputs

I have a arduino duemilanove that i bought some time ago and its been tortured. the problem im having is tha out puts seem to work fine but getting input is random like if i wire up a button sometimes it wont sense that it was pushed and sometimes i wont push it and it will say i did and the main problem im having is the analog inputs read in the 200's with nothing connected is the chip bad can i just buy a new atmega328 with the arduino bootloader and replace the old one?

robot-dude:
I have a arduino duemilanove that i bought some time ago and its been tortured. the problem im having is tha out puts seem to work fine but getting input is random like if i wire up a button sometimes it wont sense that it was pushed and sometimes i wont push it and it will say i did and the main problem im having is the analog inputs read in the 200's with nothing connected is the chip bad can i just buy a new atmega328 with the arduino bootloader and replace the old one?

Those symptoms for both digital and analog inputs pins are normal and to be expected. Do a search on 'floating input pins'. Digital input pins when interfacing to mechanical switch contacts must use either a pull-up or pull-down resistor, and pins have a programmable internal pull-up you may utilize and if used you would wire the contacts to ground the pin when activated. On analog input pins the fix is simpler, just don't read the analog values of pins that have nothing wired to them, why would one want to do such a thing?

Lefty

The reason i was looking at what i get on the analog pins when nothing is connected is because i was trying to use a tmp36 tempature sensor but i was getting totally ridiculous readings over 400 degrees when the room im in is somewhere in the 70's

robot-dude:
The reason i was looking at what i get on the analog pins when nothing is connected is because i was trying to use a tmp36 tempature sensor but i was getting totally ridiculous readings over 400 degrees when the room im in is somewhere in the 70's

OK, but your faulty temperature readings have nothing to do with reading unused pins. Reading analog or digital inputs that have nothing wired to them is not vaid as the result is just reading electrical noise.

Lefty

robot-dude:
The reason i was looking at what i get on the analog pins when nothing is connected is because i was trying to use a tmp36 tempature sensor but i was getting totally ridiculous readings over 400 degrees when the room im in is somewhere in the 70's

Have you wired it up according to the datasheet? Perhaps a photo?