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;
void setup()
{
pinMode(led,OUTPUT);
pinMode(button,INPUT);
}
void loop()
if (digitalRead(button)==HIGH)
{
digitalWrite(led,HIGH);
delay(5000);
}
else
{
digitalWrite(led,LOW);
}