public void startAction() {
   collecting = true;
   jsonDataCollector.getListeners().stream().forEach(RecordListener::start);
   startButton.setDefaultButton(false);
   stopButton.setDefaultButton(true);
   toggleButtons();
   // todo must be killed by stop action
   new Thread(
           () -> {
             while (collecting) {
               hub.run(100);
             }
             System.out.println("collecting = " + collecting);
           })
       .start();
 }
  public static void main(String[] args) {
    LoggingFactory.getInstance().configure();
    LoggingFactory.getInstance().setLevel(Level.INFO);

    try {

      MyoThalmic myo = (MyoThalmic) Runtime.start("myo", "MyoThalmic");
      myo.test();

      Hub hub = new Hub("com.example.hello-myo");

      System.out.println("Attempting to find a Myo...");
      log.info("Attempting to find a Myo");

      Myo myodevice = hub.waitForMyo(10000);

      if (myodevice == null) {
        throw new RuntimeException("Unable to find a Myo!");
      }

      System.out.println("Connected to a Myo armband!");
      log.info("Connected to a Myo armband");
      DataCollector dataCollector = new DataCollector();
      hub.addListener(dataCollector);

      while (true) {
        hub.run(1000 / 20);
        // System.out.print(dataCollector);
        System.out.println("yaw is " + dataCollector.getYaw());
        System.out.println("roll is " + dataCollector.getRoll());
        System.out.println("pitch is " + dataCollector.getPitch());

        Runtime.start("gui", "GUIService");
      }
    } catch (Exception e) {
      Logging.logError(e);
    }
  }