I have interfaced Matlab and Arduino and written code .I checked my serial communication first by using serial monitor it returns result to monitor but when I attached matlab by opening COM port from matlab and creating arduino object for serial communication to arduino.When i write command of sending data to arduino
fprintf(arduino,'%d',d)
the arduino doesnot respond to and does not print on lcd while when i send to it from serial monitor it prints and secondly i have built a function of sendserial in matlab which send data to arduino.But when i write individually the command fprintf(arduino,'%d',d) on command window of matlab with condition in arduino sketch that if it recieve 31 it turns on LED pin 13 then it responds and turn on the LED.Please help me what is the problem?
But it doesnot call my fucntions in arduino sketch when recieving data.
here is my arduino code
void loop()
{
int b[6]={
0,0,0,0,0,0 };
if(Serial.available()>0) // if there is data to read
{
matlabData=Serial.parseInt() ;
dec2bin(matlabData,b);
sprint(b);
}
}
these function are not called when it recieves data form matlab functions sendserial
matlabData=Serial.parseInt() ;
dec2bin(matlabData,b);
sprint(b);
sprint(b) function prints data to lcd