beanshell : sensor1.bsh
import java.lang.Math; source("/sdcard/com.googlecode.bshforandroid/extras/bsh/android.bsh"); a = Android(); a.call("startSensingTimed",2, 250); Thread.sleep(1000,250); s2 = a.call("sensorsReadAccelerometer").get("result"); a.call("stopSensing"); // javap(s2); double n =16.0; // threshold x = s2.getDouble(0); y = s2.getDouble(1); z = s2.getDouble(2); if (Math.abs(x)>n || Math.abs(y)>n || Math.abs(z)>n ){ if (Math.abs(x)>n) print("x="+x); if (Math.abs(y)>n) print("y="+y); if (Math.abs(z)>n) print("z="+z); a.call("vibrate",500); } print("s2="+s2);