本文整理汇总了Java中com.thalmic.myo.Hub.waitForMyo方法的典型用法代码示例。如果您正苦于以下问题:Java Hub.waitForMyo方法的具体用法?Java Hub.waitForMyo怎么用?Java Hub.waitForMyo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.thalmic.myo.Hub
的用法示例。
在下文中一共展示了Hub.waitForMyo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: connect
import com.thalmic.myo.Hub; //导入方法依赖的package包/类
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: main
import com.thalmic.myo.Hub; //导入方法依赖的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);
}
}
示例3: main
import com.thalmic.myo.Hub; //导入方法依赖的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);
}
}
示例4: main
import com.thalmic.myo.Hub; //导入方法依赖的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);
}
}