RaspberryPi/Firmata Issue 09/2020

Disclaimer: I am very new to coding, Arduinos, and raspppi, but the problem seems more than the beginner type issue (as far as I can tell).

I am trying to run code written in OF, run on a raspberrypi, connected to an Arduino with Firmata to move a robotic arm.

Everything runs well on my laptop, the robot moves the arm into distinct positions, (dipping in paint, moving to the canvas). But when I try to run the same program from my raspberrypi 4, it goes through the set up movements fine and then just stops. So it moves the servos, it’s clearly connected to the Arduino and running the code, moving into the first position. But then just stops. Either never to run again, or when I change the time function(explained below), it sometimes runs and then waits a full minute before executing the next step, over and over. Not sure what that means.

So I THINK I’ve narrowed the issue to something with time? I’m looping through the positions to move the servos, while adding a sleepmillis function to slow the movement. When I get rid of this function it seems to run more steps, but is useless because it’s out of control fast. And despite running more steps of the process it still stops. Is this a time limit issue? is it a problem with the serial connection?

Here is the code that seems to change the problem:

    if( ((ard.getAnalog(analogPinNum)) > target)){
        pos +=1;
	ofSleepMillis(30);//here is what I'm changing
        ard.sendServo(servoPinNum, pos);

    }

Since the problem began I’ve tried adding an RTC to keep time thinking it was causing the issue. But either I didn’t set it up properly or it didn’t solve anything.

Any ideas? Any glaring problems I’m overlooking? I would greatly appreciate any help. This is for an upcoming hand-in, and I’ve spent so much time googling, tweaking, and staring out the window gloomily that I’m turning to you all for help. Thank you for you time.