フィルターのクリア

How to recieve data serially from my arduino to raspberry pi via matlab?

1 回表示 (過去 30 日間)
shivam sahil
shivam sahil 2018 年 12 月 25 日
コメント済み: shivam sahil 2019 年 1 月 4 日
here is my code.
After complete configuration:
mypi=raspi();
myserialdevice = serialdev(mypi,'/dev/ttyAMA0',9600);
output = read(myserialdevice,100,'uint16')
output =
0×0 empty uint16 matrix
Even though I can see 10 recieved in my serial monitor of Arduino IDE. Also is there any way to make sure whether the connected port of arduino is correct or not? Because while trying at the first place also and creating myserialdevice, I got no error without even connecting my arduino to my pi.
  2 件のコメント
Jayaram Theegala
Jayaram Theegala 2019 年 1 月 3 日
Can you make sure that the Tx and Rx GPIO pins of Raspberry Pi and Arduino are connected correctly. Also, Raspberry Pi hardware uses +3.3 V as HIGH voltage for serial communcation,so don't directly connect to devices that use higher voltages.
To answer your second question, an error won't be thrown because even when you don't have Arduino connected, this state is same as the state when Arduino is indeed connected but not sending any data.
shivam sahil
shivam sahil 2019 年 1 月 4 日
Hi! Actually I was serially printing the data, I got it sorted by using char funciton, the data printed was just ASCII characters, now to solve it, I just added char in front of output and it is showing the data properly now.

サインインしてコメントする。

採用された回答

shivam sahil
shivam sahil 2019 年 1 月 4 日
Hey peeps, I found the answer to this question. Actually the values printed here are ASCII codes of actual characters. In case you want to see the exact output, you can use this:
char(output)
Hope this helps you all.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Support Package for Arduino Hardware についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by