   buff_ptr = buffer;
 }
 
+
 void loop()
 {
   command_t command = read_command(&serial, buffer, BUFF_LEN);
   if (command >= END_OF_COMMANDS_SECTION)
   {
+    #ifdef HAS_ERROR_PRINTING
     printError(command);
+    #endif
     return;
   }
 
   error_t error;
   
-  if (command == COMMAND_INCREMENT)
-  {
-    error = increment_output_voltage();
-  }
-  else if (command == COMMAND_DECREMENT)
-  {
-    error = decrement_output_voltage();
-  }
-  else if (command == COMMAND_SET_VOLTS)
-  {
-    error = parse_and_run_voltage_command(buffer);
-  }
-  else if (command == COMMAND_SET_HEX)
-  {
-    error = parse_and_run_hex_command(buffer);
-  }
-  else
-  {
-    error = ERROR_UNKNOWN_COMMAND;
-  }
-
+  switch(command)
+  {
+    
+    #ifdef HAS_INCREMENT_COMMAND
+    case COMMAND_INCREMENT:
+    {
+      error = increment_output_voltage();
+      break;
+    }
+    #endif
+  
+    #ifdef HAS_DECREMENT_COMMAND
+    case COMMAND_DECREMENT:
+    {
+      error = decrement_output_voltage();
+      break;
+    }
+    #endif
+  
+    #ifdef HAS_VOLTS_COMMAND
+    case COMMAND_SET_VOLTS:
+    {
+      error = parse_and_run_voltage_command(buffer);
+      break;
+    }
+    #endif
+  
+    #ifdef HAS_HEX_COMMAND
+    case COMMAND_SET_HEX:
+    {
+      error = parse_and_run_hex_command(buffer);
+      break;
+    }
+    #endif
+  
+    default:
+    {
+      error = ERROR_UNKNOWN_COMMAND;
+      break;
+    }
+  }
+  
   if (error != OK_NO_ERROR)
   {
+    #ifdef HAS_ERROR_PRINTING
     printError(error);
+    #endif
     return;
   }
   
+  #ifdef HAS_SUCCESS_PRINTING
   printSuccess(command);
-}
+  #endif
+}
+
 
 command_t read_command(SoftwareSerial *serial, char *buffer, uint8_t buff_len)
 {

*/

#define MIN_EXPECTED_LEN 2 // +;
#define MAX_EXPECTED_LEN 8 // v12.345;

#define BUFF_LEN (MAX_EXPECTED_LEN + sizeof('\0'))
char buffer[BUFF_LEN];
char *buff_ptr;

void setup()
{
  delay(1);
  serial.begin(9600);
  serial.print("OK;");
  serial.flush();
  
  // start up the SPI bus
  mySPI.begin();

    
  char ch = serial->read();
  
  switch(ch)
  {
    #ifdef HAS_INCREMENT_COMMAND
    case '+':
    {
      uint8_t num_chars_consumed = consume_until_sentinel(serial, ';');
      if (num_chars_consumed == 1)
      {
        return COMMAND_INCREMENT;
      }
      else
      {
        return ERROR_PARSING_INCREMENT_COMMAND;
      }
    }
    #endif
    
    #ifdef HAS_DECREMENT_COMMAND
    case '-':
    {
      uint8_t num_chars_consumed = consume_until_sentinel(serial, ';');
      if (num_chars_consumed == 1)
      {
        return COMMAND_DECREMENT;
      }
      else
      {
        return ERROR_PARSING_DECREMENT_COMMAND;
      }
    }
    #endif
    
    #ifdef HAS_HEX_COMMAND
    case 'x':
    {
      // prepend buffer with '0x'
      buffer[0] = '0';
      buffer[1] = 'x';
      buff_ptr = buffer+2;
    
      // read the hex characters into buffer
      error_t error = read_until_sentinel(serial, buffer, buff_len-2, ';');    
      if (error == OK_NO_ERROR)
      {
        return COMMAND_SET_HEX;
      }
      else // i.e. if (error == ERROR_BUFFER_FILLED_UP_BEFORE_SENTINEL_REACHED)
      {      
        return ERROR_BUFFER_FILLED_UP_BEFORE_SENTINEL_REACHED_WHILE_PARSING_HEX_COMMAND;
      }
    }
    #endif

    #ifdef HAS_VOLTS_COMMAND
    case 'v':
    {
      // read the floating point string into buffer
      error_t error = read_until_sentinel(serial, buffer, buff_len, ';');
      if (error == OK_NO_ERROR)
      {
        return COMMAND_SET_VOLTS;
      }
      else // i.e. if (error == ERROR_BUFFER_FILLED_UP_BEFORE_SENTINEL_REACHED)
      {      
        return ERROR_BUFFER_FILLED_UP_BEFORE_SENTINEL_REACHED_WHILE_PARSING_VOLTS_COMMAND;
      }
    }
    #endif
    
    
    default:
    {
      return ERROR_UNKNOWN_COMMAND;
    }
  }
}


uint8_t consume_until_sentinel(SoftwareSerial *serial, char sentinel)
{
