// write RR values to a text file kept in the application data directory for possible later use
  public void writeRR(View v) {
    try {

      // status.setMessage("writing RR values to file");
      SimpleDateFormat format = new SimpleDateFormat("yyyy_MM_dd_HH_mm");

      // give user feedback the button worked
      v.playSoundEffect(SoundEffectConstants.CLICK);

      double starttime = series.getX(0);
      String mydate = (format.format(starttime));

      String FILENAME = "rr_" + mydate + ".txt";
      status.setMessage("writing RR values to file to Documents  " + FILENAME);
      File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS);
      File file = new File(path, "/" + FILENAME);

      dbg(file.getAbsolutePath().toString());
      file.createNewFile();

      FileOutputStream fos = new FileOutputStream(file);

      for (int i = 1; i < series.getItemCount(); i++) {
        int temprr = (int) (series.getX(i) - series.getX(i - 1));
        String s = String.valueOf(temprr) + "\n";

        fos.write(s.getBytes());
      }
      fos.close();

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
 public void startZephyr(View v) {
   v.playSoundEffect(SoundEffectConstants.CLICK);
   status.setMessage("Connecting Zephyr");
   x = System.currentTimeMillis();
   zm.connect();
 }