There are the things to take a hard look at , perhaps the "switch" needs some more work too.
case STATE_6:
Serial.print(raak, DEC); // print raak in decimal format
Serial.print(send, DEC);
if(Serial.available()>14 && Serial.available()<17)
This should just detect presence of data - generic term , the actual data format is irrelevant
just if(Serial,available()) NOTHING else , no HIGH , == 1 , >0 , != -1 etc.
raak2 = Serial.read(); reads SINGLE 8 bits variable from serial buffer
[b]now is the time to check the value of raak2 and analyze its format - numeric value between 13 and 17 or ASCII character or "end marker " or whatever [/b]
state = STATE_7;
change state and apparently ignore raak2 in this state , just pass it on ?
Perhaps just result of the initial if() being as it was.
break;
}
break;
case STATE_7: