[Tutor] how to transform the data as below?

Peter Otten __peter__ at web.de
Fri Mar 18 11:31:38 EDT 2016


Yeh wrote:

> Thanks for your help,
> 
> Sorry for top-post and MUC. It is MCU - Micro Controller Unit.
> 
>> I supposed that you are trying to read binary data.
> 
> my friend said to me that the data should be the hexadecimal, and I need
> convert them to string "YY" and decimal integers first. but why the data
> which I received are including "YY"? Is it due to "recvfrom"?

I suppose he thinks that hexadecimal and binary is the same. The data you 
showed is binary. For example the following sequence of bytes

9 1 120 1 253 2

is displayed as the bytestring

b'\t\x01x\x01\xfd'

in Python. When the bytes are shown as hexadecimal numbers the same data 
looks like this:

09 01 78 01 fd 02


>> If you can control what data is generated then using text would indeed
>> simplify things.
> 
> using text mean strings? If it still doesn't work, we will try to send
> strings from MCU, but for efficiency, the hexadecimal is better, right?

First make it work, then worry about "efficiency".
 
> Finaly, we are going to pack the data to OSC messages to some musical
> softwares. We have already sent OSC messages from Python via UDP. But when
> we try to change the client to a MCU, we got these problems.
> 
> So... What can we do next?

Look for a library that understands OSC? 
I assume that means Open Sound Control...



More information about the Tutor mailing list