![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/178703/image.jpeg)
Simulink: uint8 vector to individual uint8s
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Andreas Nagl
el 14 de Oct. de 2017
Comentada: Andreas Nagl
el 17 de Oct. de 2017
Hello,
I need to send 6 bytes via the Arduino TCP/IP Send block (be careful: the ethernet one, not the wifi one, which accepts uint8 vectors): The problem is that it only allows uint8.
However, I have a vector of 6 uint8 values, let's say [1,2,3,4,5,6] returned by my custom MATLAB function:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/168261/image.png)
Now as you see, I have become rather desperate to bring my uint8s into a form suitable to send. Is there a way to use that Unbuffer properly? Or is it possible to somehow loop through the uints8 and pass them on to the block? Any other workaround?
Any help is appreciated - thanks a lot!
Best, Andreas
0 comentarios
Respuesta aceptada
David Ding
el 17 de Oct. de 2017
Hi Andreas,
I see that you are trying to serialize the vector of uint8s coming from a MATLAB Function block. In this case, instead of using the "unbuffer" block, consider using a "Byte Unpack" block from the "Utilities" folder of the Simulink Support Package for Arduino Hardware, found in the Simulink Library Browser. I have attached the image for your reference.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/178703/image.jpeg)
For more information about the "Byte Unpack" block in the Arduino Support Package, please refer below:
Sincerely,
David
3 comentarios
David Ding
el 17 de Oct. de 2017
Hi Andreas,
That is exactly correct! The "Byte Unpack" block of the support package is especially designed to serialize data to communicate to the Arduino Hardware.
Thanks,
David
Más respuestas (0)
Ver también
Categorías
Más información sobre Setup and Configuration en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!