So the question is, how to implement a Saturation function on Arduino?
Well, uh, you write something like this:
...
u = k*sat(s);
...
int sat(float s) {
if (s > 1) return -1;
if (s < -1) return -1;
return s;
}
That's a saturation function. It's a simple one. The odds are high that, out of the infinite-dimensional space of possible functions, this isn't exactly the one you want.
For anyone who's actually contemplating sliding mode control on an Arduino, this task should be trivial. You shouldn't be asking this question.
What is it that you really want to know?