unable to receive data in arduino from matlab
조회 수: 1 (최근 30일)
이전 댓글 표시
I have tried to send integer from matlab to arduino
my matlab code is
clc;
clear all;
close all;
s=serial('COM4','BAUDRATE',9600);
fopen(s);
fprintf(s,'%i',1);
fclose(s);
and my arduino code is
void setup()
{
Serial.begin(9600);
}
void loop()
{
if(Serial.available()>0)
{
int b=Serial.read();
if(v==1)
{
Serial.println(v);
}
else
{
Serial.println(v);
}
}
}
After uploading it to arduino uno and clicking on serial monitor i am not getting any output. its just blank![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/249100/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/249100/image.jpeg)
Is there any mistake in my code or my connectivity process??
댓글 수: 5
Walter Roberson
2019년 11월 20일
s=serial('COM4','BAUDRATE',9600);
fopen(s);
fwrite(s, uint8(1));
fclose(s);
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 MATLAB Support Package for Arduino Hardware에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!