我怎样才能通过编程来震动Myo。
我可以在TLMHubDidConnectDeviceNotification中进行振动,但是我可以在TLMMyoDidReceiveOrientationEventNotification中使用它,因为在这个通知中没有TLMMyo的实例。
Eg:在TLMHubDidConnectDeviceNotification中的振动
TLMMyo *myo = notification.userInfo[kTLMKeyMyo];
[myo vibrateWithLength:TLMVibrationLengthLong];
[myo vibrateWithLength:TLMVibrationLengthMedium];
[myo vibrateWithLength:TLMVibrationLengthShort];我还试图将实例保存在@property中,但在TLMMyoDidReceiveOrientationEventNotification中,这个实例是nil。
PS:Myo开发者论坛提问
发布于 2015-12-14 15:33:28
好像那个通知有个漏洞。同时,您可以在TLMHub单例的myoDevices方法上访问myoDevicess。如果使用多个Myo设备,则可以使用identifier属性在TLMMyo上识别要使用的设备。
不过,我将研究如何从长远角度解决通知问题。
TLMMyo *myo = [[[TLMHub sharedHub] myoDevices] firstObject];
if (myo.identifier == self.identifier) {
[myo vibrateWithLength:TLMVibrationLengthLong];
[myo vibrateWithLength:TLMVibrationLengthMedium];
[myo vibrateWithLength:TLMVibrationLengthShort];
}https://stackoverflow.com/questions/34269472
复制相似问题