Hello guys, I am doing a small project, taking readings with MATLAB from Arduino and plotting them in realtime. The problem that I have is that after my code runs for 30-60 seconds I start to have huuuuuuuuge delays, the longer the code runs the longer the delays get, while if I look at the readings in the Arduino Serial Monitor there are no delays there at all. Like I said the longer the code runs the longer delays I get, it gets to a point where it registers an event that happened 5-6-7 seconds after it happened and I don't understand what is causing this.
Here are my codes:
MATLAB Code - close all;clear all;clc;delete(instrfindall); %close all opened serial po - Pastebin.com
Arduino Code - #define ECHOPIN 12 //set pin 12 on the Arduino board as the ECHO pin - Pastebin.com