4

I'm trying to get some binary data from an Arduino Due to Matlab.

Basically this is the setup:

Due:

byte usbMsg[33]= {0};
// filled with dummy as example
usbMsg[1] = '00000001';// in[3];
usbMsg[2] = '00000001';//in[4];
usbMsg[3] = '00000001';//in[5];
.
.
.
SerialUSB.write(usbMsg, 33);

And on the Matlab side, I open the corresponding COM port and use a command like this one:

 a = fread(serialPort,3)

this gives me:

 a =
 49
 49
 49

which is the ASCII representation of the data I sent.

Can anyone explain to me why this happens and what I could do? As I understood serial.write sends binary data and fread reads binary data.

VE7JRO
2,51519 gold badges27 silver badges29 bronze badges
asked Sep 4, 2016 at 15:10
1
  • You do you intend with the statement; usbMsg[1] = '00000001'? Check what this means in C/C++. Commented Sep 4, 2016 at 16:09

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.