To give a brief overview of my project, I am making a satellite, I'm using arduino as my controller and simulating my satellite model and sensors in simulink to test if my controller works. I intend to send data from simulink to arduino, have my arduino process the data and perform some calculations, and then send it back to simulink.
Right now I am just trying to send a receive my data from my arduino, the arduino code I'm using is as shown:
Right now I am only able to transmit integers to and from my arduino.
When I try to transmit a matrix of integers, I receive the elements of the matrix one by one.
When I send a decimal (Eg. 0.002) , the data I receive is rubbish.
The data I'm required to send is a matrix signal which decimal elements varying from 0~1. How can I achieve this?
I understand that the data is sent back to Simulink as a byte or bytes. But sometimes my decimals may require more than a byte. I'm looking for a way to collect all the bytes and then get the decimal number.
PaulS:
Is the sender sending binary data or ASCII data?
Did you READ AWOL's link?
My bad, I didn't see that AWOL's guide was spread out across multiple posts.
Simulink sends binary data to the Arduino. I have the option to add a header and terminator to my binary data too. I'll try to code something out and post back here if I have any issues.