if possible I would like to request vibrate module - would be nice for games etc.
Forum Archive
Vibrate module
userista
Aug 14, 2015 - 18:15
omz
Aug 14, 2015 - 18:34
It's relatively easy to trigger a simple vibration using ctypes, but there's no API to control the duration, intensity etc.
import ctypes
import time
c = ctypes.CDLL(None)
def vibrate():
p = c.AudioServicesPlaySystemSound
p.restype, p.argtypes = None, [ctypes.c_int32]
vibrate_id = 0x00000fff
p(vibrate_id)
if __name__ == '__main__':
for i in xrange(3):
vibrate()
time.sleep(0.5)
userista
Aug 14, 2015 - 18:50
Sweet! That's perfect for my use case.
Webmaster4o
Jan 10, 2016 - 03:17
Is this now easier with objc_util?
JonB
Jan 10, 2016 - 05:54
Pure c calls are basically the same with or without objc. Since the vibrate api is pure c, and not part of an objc class, the code would be the same.
Webmaster4o
Jan 10, 2016 - 14:32
Ok, just wondering. Thanks.
dream945
May 11, 2017 - 10:40
@omz Thank you for your Vibrate module.
The process went successfully when done according to your instructions.
At a time such as when you are on the phone and the alarm goes off, can it vibrate for a long time?
Objective-C seems to write in this way.
http://stackoverflow.com/questions/1490028/iphone-dev-performselectorwithobjectafterdelay-or-nstimer