You don't need the resistors for 5V input. Try: delayMicroseconds(5000); //instead of 500
delayMicroseconds(5000); //instead of 500