Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Korakot Chaovavanich http://korakot.stumbleupon.com

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Make a phone vibrating periodically

Some of my friends who practise mindfulness meditation
use an alarm device that vibrate every 2 minutes and
he will become mindful then.
Danny O'Brien of Life Hacks fame asked me about this too.
So, here's a short example (without parameter setting GUI)
that does exactly this.

You need to have miso library install. Only Series 60
2nd Ed FP2 device (Nokia 6630, Nokia 6680) can be used.
See vibrate(...) in miso documentation
http://pdis.hiit.fi/pdis/download/miso/miso-1.40-api.html
   1  
   2  import appuifw, miso, e32
   3  
   4  # run-and-break type of app
   5  running = 1
   6  def set_exit():
   7      global running
   8      running = 0
   9  appuifw.app.exit_key_handler= set_exit
  10  
  11  # main loop
  12  while running:
  13      miso.vibrate(500, 100)  # vibrate for 500 millisec, at full speed
  14      e32.ao_sleep(10)   # vibrate every 10 seconds

I don't have a FP2 phone to test this. Though the code is
pretty straight forward, please report if there is a problem.
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS