Braccio Winkel erechnen

Hellow alle zusammen,
ich habe mir so ein Tollen Robottergreifer geholt, und habe auch geschafft ihn zu programmieren. Nun wollte ich dass Programm erweitern, so das ich dem Arduino uno per Serielle Kommunikation den Motor und die Winkelwerte (M[Motor] [Winkelwerte]).
Das erste mal funktioniert das auch, aber dann beim 2. mal addiert sich die Winkelwerte zu dem ersten mal hinzu und das ist blöd, da der so kaputtgehen kann. Ich bin mir ziemlich sicher, das ist ein Fehler am Code. Ich kann ihn aber nicht finden =/
Also hier ist der Code:

/*
  simpleMovements.ino
  This  sketch simpleMovements shows how they move each servo motor of Braccio
  Created on 18 Nov 2015
  by Andrea Martino
  This example is in the public domain.
*/

#include <Braccio.h>
#include <Servo.h>

Servo base;
Servo shoulder;
Servo elbow;
Servo wrist_rot;
Servo wrist_ver;
Servo gripper;

int read_ = 0;
int readM = 0;
int readW = 0;
int Movements[6] {
  90, 45, 150, 45, 90, 10
};



void setup() {
  //Initialization functions and set up the initial position for Braccio
  //All the servo motors will be positioned in the "safety" position:
  //Base (M1):90 degrees
  //Shoulder (M2): 45 degrees
  //Elbow (M3): 180 degrees
  //Wrist vertical (M4): 180 degrees
  //Wrist rotation (M5): 90 degrees
  //gripper (M6): 10 degrees
  Braccio.begin();

  Serial.begin(9600);

  Braccio.ServoMovement(20, 0, 45, 180, 180, 90, 10);
  delay(500);
  Braccio.ServoMovement(20, 0, 80, 180, 180, 90, 10);
  delay(200);
  Braccio.ServoMovement(20, 0, 80, 150, 180, 90, 10);
  delay(150);
  Braccio.ServoMovement(20, 0, 80, 150, 137, 90, 10);
  delay(300);
  Braccio.ServoMovement(20, 0, 80, 150, 137, 90, 69);
}

void loop() {
  /*
    Step Delay: a milliseconds delay between the movement of each servo.  Allowed values from 10 to 30 msec.
    M1=base degrees. Allowed values from 0 to 180 degrees
    M2=shoulder degrees. Allowed values from 15 to 165 degrees
    M3=elbow degrees. Allowed values from 0 to 180 degrees
    M4=wrist vertical degrees. Allowed values from 0 to 180 degrees
    M5=wrist rotation degrees. Allowed values from 0 to 180 degrees
    M6=gripper degrees. Allowed values from 10 to 73 degrees. 10: the toungue is open, 73: the gripper is closed.
  */

  if (Serial.available() > 0) {
    int input = 0;
     input = Serial.read();
 //   Serial.println(input);

    if (input == 109 || input == 77) {
      read_ = 1;
    }
    else {
      if (read_ == 1) {
        read_ = 2;
        readM = input - 48;
        Serial.print("M");
        Serial.println(readM);
      }
      else {
        if (read_ == 2) {
          read_ = 3;
        }
        else {
          if (read_ == 3) {
            read_ = 4;
            readW = readW + ((input - 48) * 10);
            Serial.println(readW);
          }
          else {
            if (read_ == 4) {
              read_ = 5;
              if (input == 10) {
                read_ = 0;
              }
              else {
                readW = readW + ((input - 48) * 100);
              }
              if (read_ == 5) {
                read_ = 0;
                if (input != 10) {
                  readW = readW + ((input - 48) * 100);
                }
              }
            }
          }
          Movements[readM] = readW;
        }
      }
    }
  }

  Braccio.ServoMovement(20, Movements[1], Movements[2], Movements[3], Movements[4], Movements[5], Movements[6]);

  //(step delay, M1, M2, M3, M4, M5, M6);
  //  Braccio.ServoMovement(20, 0, state, 180, 180, 90, 11);
}

Kann mir bitte wer helfen?
Lg, hellow2

readW wird nie zurückgesetzt.

Der Sketch wird übrigens leichter lesbar, wenn du die Zauberzahlen 48, 77, 109
durch lesbare ersetzt ( '0' 'M' 'm' )

Ok danke,
jetzt funktionierts

Die Lösung des Problems behälst Du aber aus Datenschutzgründen für Dich?

LG Stefan

Die Lösung des Problems behälst Du aber aus Datenschutzgründen für Dich?

nein. Um anderen den Knobelspaß nicht zu verderben