Hi all,
I recently switched from the Arduino Duemilanove to the Arduino Due. My Duemilanove setup was able to send data to MATLAB over the serial port. I'm now trying to do the same thing with the Due using the native USB port. In the Arduino code I changed "serial" to "serialUSB", and when I look at the data in the serial monitor it looks perfectly fine. BUT... MATLAB is not able to read the data although I'm using exactly the same MATLAB code.
Does anyone know what I'm missing? Thanks in advance!
...
SerialUSB.begin(115200);
while(!SerialUSB);
...
SerialUSB.println((char)'S'); // Send capital S
SerialUSB.println(sampleTime,DEC);
SerialUSB.println(adcValue,DEC);
...
...
% Configure serial communication
s1 = serial('/dev/ttyACM0');
s1.BaudRate = 115200;
set(s1,'terminator','LF');
fopen(s1);
...
while fscanf(s1,'%s') ~= 'S' end % Wait for capital S
time(sampleNr,1) = fscanf(s1,'%f')/1000; % Float
signal(sampleNr,1) = fscanf(s1,'%i'); % Int
...