Got myself a pitaya recently. Now playing around with python3. Made a simple scope script which works, but is not very fast.
So, tried the bin transfer mode. Already found out that I have to update the code as the default example does not work in python3.
Code: Select all
def rx_bin(self):
# The first thing it sends is always a #
#
buf = self._socket.recv(1)
print(buf.decode('utf-8'))
# The second thing it sends is the number of digits in the byte count.
buf = self._socket.recv(1)
digits_in_byte_count = int(buf)
print(digits_in_byte_count)
# The third thing it sends is the byte count
buf = self._socket.recv(digits_in_byte_count)
print(buf.decode('utf-8'))
byte_count = int(buf)
buf = []
while len(buf) != byte_count:
buf.append(self._socket.recv(1))
print(buf)
return buf
--> How to convert to floats again? I am lost!
Code: Select all
#
5
65536
[b'?', b'\x7f', b'\xf8', b'\x00', b'?', b'\x7f', b'\xf8', b'\x00', b'?', b'\x7f', b'\xf8', b'\x00', b'?', b'\x7f', b'\xf8', b'\x00', b'?', b'\x7f', b'\xf8', b'\x00', b'?', b'\x7f', b'\xf8', b'\x00', b'?', b'\x7f', b'\xf8', b'\x00', b'?', b'\x7f', b'\xf8', b'\x00', b'?', b'\x7f', b'\xf8', b'\x00', b'?', b'\x7f', b'\xf8', b'\x00'
Anyone an example on how to go to floats again? Preferable np.array?
Greetings Matthijs