Hello,
I am working on implementing LabVIEW-like functionality using the <SIMULINK Support Package for Arduino Hardware> and uploading it to an Arduino.
My goal is to implement hard constraints in Simulink (as I understand that Simulink's default behavior is soft constraint).
Here's my understanding of the concepts:
Hard constraint: In a 1kHz loop, if a loop started at time 't ms' exceeds 1ms, it stops processing the current sensor value (t ms) and moves to the next sensor value at 't+1 ms'.
Soft constraint: If the loop exceeds 1ms, it completes processing the current loop(t ms) and skips the next cycle(t+1 ms), moving to the loop with value at 't+2 ms'.
I tried to achieve this using `tic` and `toc` in the following code, but it failed to upload on the Arduino board
%% matlab code %%
function [num, y] = fcn(a,b)
persistent t
if isempty(t)
t = 0;
end
t = t+1;
num = t;
startTime = tic;
A = rand(a,b);
y = toc(startTime);
end
%%
Does anyone know a solution to this problem?
Thank you in advance.