Query about using sampler class with two pins

I am trying to understand how the Sampler class works.

I wish to take samples from two pins with analog sensors attached.

I understood from dev guide that the sampler.configure method can accept an “array” of pins and that (quote) “If an array of pins is used, all pins are sampled every period. So when sampling three pins at 1kHz, 6000 bytes of data are produced every second.”

Firstly how does one define an “array” of pins as this is not explained. Does one use this method:

sampler.configure([hardware.pin8, hadware.pin9], SampleRate, myArray_of_Blobs, myCallback_function, NORMALISE)

as in does one put the pins inside square brackets to represent an array.

Then as I want a sample rate of 100Hz my SampleRate variable will be 100 and the “myArray_of_Blobs” will need to collect 400 bytes of data and so if I understand the methods correctly, I need to create two blobs:

buffer1 <- blob(400);
buffer2 <- blob(400);

and so myArray_of_Blobs = [buffer1, buffer2]

Now what is not explained is how I read the blobs.

It says (quote) “The sampler outputs 16-bit unsigned samples (though with only 12 bits of actual resolution, in the top 12 bits)”.

So I assume I use the “blob.seek(integer, const)” method to scan through each buffer when it arrives once full.

Now what is contained inside the buffer as this is not explained. Will it be: data1 from pin8, data 1 from pin9, data2 from pin8, data2 from pin9, data3 from pin8, data3 from pin9, etc. etc.

and then what I do to extact the values is use the blob.readn(const) function where “const” will be defined as ‘w’ which is an unsigned integer.

Once I have this 16 bit value do I need to do anything further to get the correct value.

You got it right - the readings are interleaved as you suggested and you’d read them with blob.readn(‘w’) to get a word at a time. Pretty sure this will return the correct value (little-endian word).