           theta.attach(12);
           z.attach(9);
         }
-        int thetaDeg = bytes[1];
-        int zDeg = bytes[2];
-        theta.write(thetaDeg);
+        int thetaUs = (bytes[1] * 256) + (bytes[2]);
+        theta.writeMicroseconds(thetaUs);
+
+        int zDeg = bytes[3];
         z.write(zDeg);
       }
       break;

      Serial.write(msb);
      byte lsb = adcVal % 256;
      Serial.write(lsb);
      lastAdcVal=adcVal;
    }
  }

  if (Serial.available() < 3) {
    return;
  }
  Serial.readBytes(bytes, 3);
  byte cmd = bytes[0];
  bool disable = false;
  switch (cmd) {

// firmware for Arduino Nano used for Gone Fishing Robot
// Tobi Delbruck, Aug/Sept 2023 tobi@ini.uzh.ch

#include <Servo.h>

Servo theta;
