当前位置: 首页>>代码示例>>Java>>正文


Java DeviceListener类代码示例

本文整理汇总了Java中com.thalmic.myo.DeviceListener的典型用法代码示例。如果您正苦于以下问题:Java DeviceListener类的具体用法?Java DeviceListener怎么用?Java DeviceListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DeviceListener类属于com.thalmic.myo包,在下文中一共展示了DeviceListener类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import com.thalmic.myo.DeviceListener; //导入依赖的package包/类
public static void main(String[] args) {
	try {
		Hub hub = new Hub("com.example.emg-data-sample");

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

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

		System.out.println("Connected to a Myo armband!");
		myo.setStreamEmg(StreamEmgType.STREAM_EMG_ENABLED);
		DeviceListener dataCollector = new EmgDataCollector();
		hub.addListener(dataCollector);

		while (true) {
			hub.run(1000 / 20);
			System.out.println(dataCollector);
		}
	} catch (Exception e) {
		System.err.println("Error: ");
		e.printStackTrace();
		System.exit(1);
	}
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:27,代码来源:EmgDataSample.java

示例2: main

import com.thalmic.myo.DeviceListener; //导入依赖的package包/类
public static void main(String... args) {
	try {
		Hub hub = new Hub("com.example.multiple-myos");

		DeviceListener printer = new PrintMyoEvents();
		hub.addListener(printer);

		while (true) {
			hub.run(10);
		}
	} catch (Exception e) {
		System.err.println("Error: ");
		e.printStackTrace();
		System.exit(1);
	}
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:17,代码来源:MultipleMyos.java

示例3: main

import com.thalmic.myo.DeviceListener; //导入依赖的package包/类
public static void main(String[] args) {
	try {
		Hub hub = new Hub("com.example.hello-myo");

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

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

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

		while (true) {
			hub.run(1000 / 20);
			System.out.print(dataCollector);
		}
	} catch (Exception e) {
		System.err.println("Error: ");
		e.printStackTrace();
		System.exit(1);
	}
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:26,代码来源:HelloMyo.java

示例4: main

import com.thalmic.myo.DeviceListener; //导入依赖的package包/类
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");
		DeviceListener dataCollector = new DataCollector();
		hub.addListener(dataCollector);

		while (true) {
			hub.run(1000 / 20);
			System.out.print(dataCollector);

			Runtime.start("gui", "GUIService");

		}
	} catch (Exception e) {
		Logging.logError(e);
	}
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:37,代码来源:MyoThalmic.java

示例5: removeListener

import com.thalmic.myo.DeviceListener; //导入依赖的package包/类
public void removeListener(DeviceListener myoThalmic) {
  if (!isVirtual){
    thalmicHub.removeListener(myoThalmic);
  }
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:6,代码来源:MyoThalmic.java

示例6: addListener

import com.thalmic.myo.DeviceListener; //导入依赖的package包/类
public void addListener(DeviceListener myoThalmic) {
  if (!isVirtual){
    thalmicHub.addListener(myoThalmic);
  }
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:6,代码来源:MyoThalmic.java


注:本文中的com.thalmic.myo.DeviceListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。