Arduino Nano not working with servo code

I'm trying to control a servo on my nano with a push button. (move to 0 at initial, move to 180 on a button push, reset to 0 after another button push).

The code I have for the above was doing nothing so I moved on to troubleshooting the servo itself.

I found that this code will move the servo back and forth as it should

#include <Servo.h>
Servo servo;
void setup() {
servo.attach(5);

}
void loop() {
for(int i=0;i<180; i++){
servo.write(i);
delay(15);
}
for(int i=180; i>0; i--){
servo.write(i);
delay(7);
}

}

However, this code does nothing.

#include <Servo.h>
Servo servo;
void setup() {
servo.attach(5);
}
void loop() {
servo.write(0);
delay(400);
servo.write(180);
delay(400);
}

No changes in setup between the code change, just the code itself.

The servo I'm using is http://www.agfrc.com/index.php?id=1894

I'm powering the unit with a 5v 2a power supply usually meant for charging phones.

Both code sets work properly in driving an SG90 with no issues.

I'm hoping in figuring this out I can then figure out why my code with button presses does not work.

Thanks.

I think you just contradicted yourself.
But, try changing the range of motion to 45 to 135. Many of the small SG90s don't actually travel the whole 180 degrees; under the hood, those degree values are getting changed to pulse widths, and it may be that the pulse widths for 0 and 180 are beyond the limits for the particular servo you have.
C

Thank you. Amazingly that seems to be the case in these linear servos. 26 -> 20 is apparently the full range of motion and works with my button press code.