public abstract class AccelerometerListener
extends java.lang.Object
Constructor and Description |
---|
AccelerometerListener(HB hb) |
Modifier and Type | Method and Description |
---|---|
float |
scaleValue(double sensor_value,
double scaled_min,
double scaled_max)
Scale the values based on a maximum and minimum sensor value of 1 / -1
The value can be greater than scaled_min and scaled_max if sensor_value is greater than abs(1)
((scaled_max - scaled_min) * (sensor_value - sensor_min)) / (sensor_max - sensor_min) + scaled_min;
|
abstract void |
sensorUpdated(float x_val,
float y_val,
float z_val)
Sensor has been updated
|
void |
setRounding(int resolution)
Set the resolution for all three axis to the number of decimal places
set by resolution.
|
public AccelerometerListener(HB hb)
public void setRounding(int resolution)
resolution
- the number of decimal places to round to. -1 will be no roundingpublic float scaleValue(double sensor_value, double scaled_min, double scaled_max)
scaled_min
- The value we want our standard minimum sensor value to becomesensor_value
- The actual value of our sensorscaled_max
- The value we want our standard maximum sensor value to becomepublic abstract void sensorUpdated(float x_val, float y_val, float z_val)
x_val
- x value of accelerometery_val
- y value of accelerometerz_val
- z value of accelerometer