Exploring Interaction

We now have a continuous readout from the magnetometer sensor. Next step is to play with magnets nearby the sensor to see how the values are changing. One thing we could do is to create a sort of distance measure.

myAzimuth = Math.round(event.values[0]);
myPitch = Math.round(event.values[1]);
myRoll = Math.round(event.values[2]);
abssum = Math.abs(myAzimuth) + Math.abs(myPitch) + Math.abs(myRoll);
Log.d(TAG,"onSensorChanged:"+abssum); 

Another way is to calculate the absolute value:

myAzimuth = Math.round(event.values[0] * event.values[0]);
myPitch = Math.round(event.values[1] * event.values[1]);
myRoll = Math.round(event.values[2] * event.values[2]);
abssum = Math.sqrt(myAzimuth + myPitch + myRoll);
Log.d(TAG,"onSensorChanged:"+abssum);

Now – how can we make use of this to explore various ways of interacting with the device?