   Serial.begin(UART_BAUD_RATE);
   Serial << F("YaesuTest: starting ...") << endl;
   
- #if defined (__AVR__)
-  Serial << F("Free SRAM: ") << availableMemory() << endl;
- #endif // (__AVR__)
+  Serial << F("Free SRAM: ") << getFreeRAM() << endl;
 #endif // DEBUG
 
   // set the data rate for the SoftwareSerial port(s)

/** 
 *  Try to inquire max. available memory by allocating until heap is exhausted.
 */
#if defined (__AVR__)
static int availableMemory() {

#if 0
  // from: https://devel-ik.fzk.de/wsvn/fd-online/Diverse/Oktokopter/Arduino2Flasher/trunk/Arduino2Flasher.ino
  int size = 10000;
  byte *buf;
  while ((buf = (byte *) malloc(--size)) == NULL);
  free(buf);
  return size;
#else
  // see also:
  // https://learn.adafruit.com/memories-of-an-arduino/measuring-free-memory
  extern int __heap_start, *__brkval; 
  int v; 

  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); 
#endif
}
#endif // (__AVR__)


#endif // (__AVR__)

// local prototypes
static int getFreeRAM();

void setup() {

