Turning Motor for Set Time on KeyPress

I am serializing a key stroke in processing and looking for the serialized data in my arduino sketch. When the key (r) is pressed the motor turns to the right for a set amount of time for each key press. Everything is working, however, after what seems to be a random time the serial stops reading and getting the data that processing is trying to send. I have noooo idea why. am i sending too much data too fast? is the arduino not getting enough power (powered by an IMac usb port)? I just don’t know.

using an Arduino UNO,
using a SpringRC SM-S4303R servo motor…

this is my processing sketch:

import processing.serial.*;
Serial port;
int c=0;

void setup() {
port = new Serial(this, Serial.list()[5], 9600);

void keyPressed() {
String s = “0”;
if (key == ‘r’) {
s = “1\n”;

void draw() {

and this is my arduino sketch:

#include <Servo.h>
Servo servoLeft;

void setup() {

void loop() {
while (Serial.available() > 0){
int right = Serial.parseInt();

if (Serial.read() == ‘\n’) {
delay(50); //time for the servo to move

Thanks for all your help!!