示例#1
0
 public void run() {
   running = true;
   while (running) {
     hub.run(1000 / 20);
     log.info(myService.toString());
   }
 }
示例#2
0
  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);
    }
  }