Serial timeout when reading inputs

Hello there!

For apparently no reason, if I add a digitalRead or analogRead to the code it will not upload anymore!
There is a W5100 generic ethernet shield connected to it.

The code:

#include <SPI.h> 
#include <Ethernet.h>
#include <Twitter.h>

byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = {192, 168, 139, 216 };
byte DNS[] = {200, 18, 33, 18 };
byte gateway[] = {192, 168, 136, 1 };
byte subnet[] = {255, 255, 248, 0 };

Twitter twitter("MYKEY");
char msg[] = "ALARME!! TESTE";
int sensorAlarme = 14;

void setup(){
  delay(1000);
  Ethernet.begin(mac, ip, DNS, gateway, subnet); 
  Serial.begin(9600);
  pinMode(sensorAlarme,INPUT);
}

int leitura = 0;
void loop(){
  leitura = digitalRead(sensorAlarme);
  delay(500);
  if(leitura < 1000){
    Serial.println("LADRAO");
    enviarAlarme();
    delay(15000);
  } 
}

void enviarAlarme(){
  Serial.println("Tentando enviar mensagem de alarme ...");
  if (twitter.post(msg)) {
    int status = twitter.wait();
    if (status == 200) {
      Serial.println("Alarme enviado com sucesso.");
    } else 
      if (status == 403) {
      Serial.println("Alarme pode ter sido enviado com sucesso.");
    } else {
      Serial.print("failed : code ");
      Serial.println(status);
    }
  } else {
    Serial.println("connection failed.");
  }
}

The error output:

avrdude: Version 5.11, compiled on Sep  2 2011 at 19:38:36
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\Program Files (x86)\Arduino/hardware/tools/avr/etc/avrdude.conf"

         Using Port                    : COM7
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Recv: 
avrdude: stk500_getsync(): not in sync: resp=0x00

avrdude done.  Thank you.

After that I have to remove the USB cable from my computer and connect it again so it starts working...

If I change the line 24 (analogRead) to something like this, it uploads and runs sucessfully:

leitura = 1234;  or leitura = HIGH;

The AnalogInSerialOut example works flawlessly - also tried adding the same libraries to this sketch, but it did not stop working.