Two Minute Timer in mobile.processing

Nikolaus Gradwohl2009-04-26T09:50:00+00:00

no system or programming language should be without it's 2 minute timer for all those GTD followers out there. so i made one in mobile.processing.

the programm starts a 120 sec countdown and sends the app in background. After 2 minutes the vibration alarm is activated for 1 second.

i made a qr-barcode that contains the link to the jad file. just point a qrcode reader like zxing to it and install it

install twominute timer

you can also use the direct link https://www.local-guru.net/mobileprocessing/twominutetimer/midlet/twominutetimer.jad (but i think it is a bit complicated to enter on a mobile phone)

import processing.phone.; import javax.microedition.midlet.; import javax.microedition.lcdui.*; Phone p;

PFont font;
int mil;
Display display;
Displayable screen; 

int wait = 2 * 60 * 1000;

void setup() {
  display = Display.getDisplay(this);
  screen = display.getCurrent(); 
  p = new Phone(this);

  font = loadFont(FACE_PROPORTIONAL, STYLE_PLAIN, SIZE_LARGE);
  textFont(font);
  textAlign(CENTER);
  fill(0);
  int mil = millis();
  display.setCurrent(null);   
}

void draw() {
   background(255);
   text( "" + (wait - (millis() - mil)), width/2, height/2);

  if ( millis() - mil > wait ) {
    display.setCurrent(screen); 
    p.vibrate(1000);
    p.flash(1000);
  }

  if ( millis() - mil > wait + 1000 ) {
    exit();
  }
}
Tweet This! submit to reddit Digg! Tags: | 1 comments | no trackbacks

See also:

Random numbers with MobileProcessing
qr-code midlet installer
sketch experiment 7 - osc events
nested cubes in processing
processing phaseflower

Trackbacks

Comments

Leave a response

  1. mobile development 2009-11-30T07:10:37+00:00

    Thanks for the useful script. I was searching something similar to this for quite a long time. Editing mobile.processing isn't an easy thing for me so you have helped me a lot. I will be waiting for more great articles from you in the nearest future. Thanks!

Leave a comment