(for example make the Arduino blink the LED at pin13, rather than send something back. Break it down even further until you have something that works, like just transferring one byte. You already have trimmed down the test to a small example. And when the error finally is found, it was not the machine, that is, either the code or the wiring one has made, had the fault. Yeah, well, we all get that feeling sometimes. I hope u can help me, because i'am really desperate. I=Serial.read() // read it and store it in 'i' If(Serial.available()) // if data is available to read put your main code here, to run repeatedly: put your setup code here, to run once: Line = fscanf(arduino, '%d') % get data if there exists data in the next lineįclose(arduino) % close it when accident happens Set(arduino,'Terminator','LF') % define the terminator for printlnįopen(arduino) % initiate arduino communicationįprintf(arduino,'%s',char(answer)) % send answer variable content to arduino %Change the Terminator property of the serial port to make it faster I hope u can help me, because i'am really desperate.Īrduino = serial('COM11','BaudRate',9600) I have got probably mistakes in the code. It is really annoying reboot matlab every few moments.
I tried install some ArduinoIO package for matlab, but it's still same. Then i must reboot matlab, sometimes entire computer. Matlab show me every time Error: No device on serialPort COM11. Probably because the data not coming back. In matlab workspace are created variables, but they are empty. Warning: Unsuccesful read: A timeout occured before the Terminator reached. Warning: Unsuccesful read: The specified amount of data was not returned within the timeout period. I saw many articles and tutorials on this topic. I need to send some numbers to the arduino and then send them back from arduino. I use Arduino uno and Matlab version is R2012a. I need to create communication between Matlab and Arduino. First I want to apologize for my English.