Arduino Servo with Serial
Like Mikael Patel said, SoftwareSerial disables interrupts for the entire character receive time.  Bad juju.

This answer lists the alternatives:


HardwareSerial is always the best.  Simply connect the device to pins 0 &amp; 1 and use the pre-defined Serial variable.  On some Arduinos, there are extra HardwareSerial ports, called Serial1, Serial2, etc.  The UNO only has Serial.  Serial would not interfere with the Servo.
AltSoftSerial is the best of the software serial libraries.  Only one instance is allowed, and it is must be used on the Input Capture pins (pins 8 &amp; 9 for a Nano).  It would not interfere with the Servo.
My NeoSWSerial is next best.  It works on any two pins, but only at baud rates 9600, 19200 and 38400.  Receiving characters does not disable interrupts, but transmitting does (i.e., TX would interfere with the Servo).
SoftwareSerial is the worst choice.  It works on any two pins, but it is very inefficient.  It disables interrupts for the entire time that a character is being sent OR received, and it cannot transmit and receive at the same time (unlike all other choices).  This can interfere with other parts of your sketch, other device communications, or with libraries (e.g., Servo).


In your case, I would suggest connecting the HC-12 to pins 0/1 and use Serial.  No software serial library required, but you will have to disconnect pin 0 to upload new sketches over USB.  Some people put a switch in that wire so it's easy to upload a new sketch.

If you need debug prints, I would suggest using AltSoftSerial and an extra TTL Serial-to-USB adapter (aka FTDI module) to your PC.  Then print your debug messages to the AltSoftSerial variable:

#include &lt;AltSoftSerial.h&gt;
AltSoftSerial debugPort; // always pins 8 &amp; 9

   ...

void loop()
{
  if (something) {
    debugPort.println( F("something happened!") );


Or, if the HC-12 connection is receive only, don't connect pin 1 (TX).  Then your debug prints won't go to the HC-12.

BTW, don't use delay and don't use String.  They will get you into trouble sooner or later.