Send array of values

Hi,

How do i send an array of values to a raspberry pi as opposed to an image object? I have it working for an image object its more how do I package the array. So I have my “img” which is actually an array of 16 bit values but I am not entirely sure how I send those back to the host device. I stored the img as .bmp but when I opened it on the host device and read in the contents I was getting an rgb tuple.

You have to use he python struct module to pack the values into outputs to be sent. Alternatively you can send the array as a string. By just doing str() on it. However, this will not be an efficient transfer.

Given that my array is full of 16 bit data I tried packaging it as .pgm file but when reading on the host device it see’s them as 8 bit values for some reason.

Did you follow the spec for generating a PGM file?

http://netpbm.sourceforge.net/doc/pgm.html