ams java

Here is a little package to easily control things by tilting your powerbook. To use download the source or java below and incorporate them in your project:

There is basically one file, and it's here: Control.java. There are two examples, Example1 and Example2 along with a file Main.java to launch them. The API is here, but basically you create an instance of the class ams.Control.Callback which has one method, process(int x, int y, int z) and pass this to the start method of an ams.Control.Callback instance.

Here is a very simple example of a callback that simply prints out the coordinates of your mac.

    Control c = new Control();
    c.start(new Control.Callback() {
        public void process(int x, int y, int z) {
          System.out.println(x + "," + y + "," + z);
        }
      });