summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustav Sörnäs <gusso230@student.li.se>2019-10-19 16:20:14 +0200
committerGustav Sörnäs <gusso230@student.li.se>2019-10-19 16:20:14 +0200
commit347756aed1d5f378d4732811495ad47a2e8d667d (patch)
tree6dcdddc5273cdd6cc80378ba27445a07bf5cdd2e
parent4d0480a2e07c92b200fe3bb87e929d970f9e212b (diff)
downloadtfyy51-347756aed1d5f378d4732811495ad47a2e8d667d.tar.gz
Add send_data-function
-rw-r--r--Kod/bilbana/yc4/display/send_data_to_display.m28
1 files changed, 28 insertions, 0 deletions
diff --git a/Kod/bilbana/yc4/display/send_data_to_display.m b/Kod/bilbana/yc4/display/send_data_to_display.m
new file mode 100644
index 0000000..8df03f7
--- /dev/null
+++ b/Kod/bilbana/yc4/display/send_data_to_display.m
@@ -0,0 +1,28 @@
+function [] = send_data_to_display()
+%SEND_DATA_TO_DISPLAY sends available data to display if last send was
+% more than 0.5 seconds ago.
+ persistent last_send;
+ global display_data;
+
+ if isempty(display_data)
+ return
+ end
+ disp(last_send);
+ disp(clock);
+ if isempty(last_send) % first send
+ %% SEND DATA
+ disp('sending data');
+ disp(display_data)
+ matlabclient(1, display_data{1});
+ last_send = clock;
+ display_data(1) = [];
+ elseif (etime(clock, last_send) >= 0.5)
+ %% SEND DATA
+ disp('sending data');
+ disp(display_data)
+ matlabclient(1, display_data{1});
+ last_send = clock;
+ display_data(1) = [];
+ end
+end
+