i used exactly the code from examples menu !! also i wired the circuit as shown in here http://arduino.cc/en/Tutorial/DigitalReadSerial
with exactly the same resistance !
for the other circuit i used a code just like that !
int button = 2;
int led = 12;