예제 #1
0
  public void connect() {

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

    System.out.println("Attempting to find a Myo...");
    log.info("Attempting to find a Myo");
    myo = hub.waitForMyo(10000);

    if (myo == null) {
      // throw new RuntimeException("Unable to find a Myo!");
      log.info("Unable to find a Myo");
    }

    System.out.println("Connected to a Myo armband!");
    log.info("Connected to a Myo armband");
    hub.addListener(this);

    if (hubThread == null) {
      hubThread = new HubThread(this);
      hubThread.start();
    }
  }
예제 #2
0
 public void disconnect() {
   if (hubThread != null) {
     hubThread.running = false;
     hubThread = null;
   }
 }