Multitasking with the Arduino Nano

So I'm trying to run a servo and an OLED screen at the same time. But every time the OLED draws a bitmap the servo stutters. What gives? Can the Nano only power one or the other? Or could it be a problem with the code?

For anyone interested in the code, it reads as follows:

void loop() { 

currentMillis = millis();
servoSweep(); 
screenSweep(); }

void servoSweep() {

if (currentMillis - previousServoMillis >= servoInterval) 
{ previousServoMillis += servoInterval; servoPosition = servoPosition + servoDegrees; }

if ((servoPosition >= servoMaxDegrees) || (servoPosition <= servoMinDegrees))
{ servoDegrees = - servoDegrees; servoPosition = servoPosition + servoDegrees; }

myservo.write(servoPosition); }

void screenSweep() {

if (currentMillis - previousMillis == intervalOne) { display.drawBitmap( 0, 0, one, 128, 64, 1); }

if (currentMillis - previousMillis == intervalTwo) { display.drawBitmap( 0, 0, two, 128, 64, 1); }

if (currentMillis - previousMillis == intervalThree) { previousMillis = currentMillis; }

}

Can the Nano only power one or the other?

You should not be using a Nano to power a servo at all. It needs a separate supply.

However, I suspect that the display software is disabling the interrupts which makes the servo stutter. If this is the case then either change the libiary so it dosn't or get an external servo driver like this Adafruit 16-Channel 12-bit PWM/Servo Driver - I2C interface [PCA9685] : ID 815 : $14.95 : Adafruit Industries, Unique & fun DIY electronics and kits