If you have code like this, for the accelerometer, for example, I am assuming that the sample size is 3, for the x,y,z values.

Code: Select all

`HiTechnicAccelerometer sensor = new HiTechnicAccelerometer(LocalEV3.get().getPort(port));`

SampleProvider sp=sensor.getAccelerationMode();

float[] sample = new float[sp.sampleSize()];

sp.fetchSample(sample, 0);

x= sample[0];

y= sample[1];

z= sample[2];

So fetchSample fills out the array with the 3 values, which can then be accessed from the array.

If so, why is the second parameter for fecthSample required?

If not, what is wrong with my assumptions?