1) This seems to work correctly for me. Maybe you are seeing the processor get stuck at a "SerialUSB.print" call- when the buffer fills up, it waits. If there isn't a serial monitor open on the computer, it waits forever. Let me know what you find here.
2) The digitalWrite(HIGH,pin) call may not set the pullup resistor like it did with AVR boards. Using pinMode(INPUT_PULLUP,pin) is a way to do this on both processors.