How to write the blow code in MATLAB Analysis ?
int16_t send_windSpeed =((msg[0] << 8) + msg[1]) ;

Antworten (1)

Yongjian Feng
Yongjian Feng am 18 Jul. 2021
Bearbeitet: Yongjian Feng am 18 Jul. 2021

0 Stimmen

Are you looking for bitshift function? Something like:
send_windSpeed = bitshift(msg(0), 8) + msg(1);

3 Kommentare

wael elsisi
wael elsisi am 18 Jul. 2021
Thank you fot your reply.
I have got this error when I wrote the code.
Unrecognized function or variable 'msg'.
Error in Get data from a private channel 3 (line 27)
sendSoil_T = bitshift(msg(0), 8) + msg(1);
Yongjian Feng
Yongjian Feng am 19 Jul. 2021
What is msg in your original code please?
wael elsisi
wael elsisi am 19 Jul. 2021
msg[0] = (send_windSpeed >> 8) & 0xFF; // highest byte
msg[1] = (send_windSpeed ) & 0xFF; // lowest byte
my_mkr.uplink(msg, 2);

Melden Sie sich an, um zu kommentieren.

Gefragt:

am 18 Jul. 2021

Kommentiert:

am 19 Jul. 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by