time while variable = 1

Hi everyone! I have a variable that communicates from arduino to ubidots with value 0 or 1, whether it is connected or not. I would like to be able to add, the time that remains with value = 1 and also to be able to add the times that it changes state to 1. Can someone help me?
thanks

Hi! I know, with timestamp function! But… Is it available for study accounts? (Stem)
Thanks!

Good day @cesc,

I hope all is well.

Indeed there is a way to calculate how long a variable remains in a value of 1, using the shift () expression. You can find the whole expression in the following article, example 2.

Now, STEM accounts only support basic mathematical functions, data range and special expressions are only available in Ubidots paid licenses.

All the best,
-Isabel