If input doesn't change in x seconds, then return msg. Else, don't return anything

Hello. Is there a way to make sure I could achieve this condition. I am using a proximity sensor, which is connected to raspberry pi. There are times when the raspberry give me input even though the proximity doesn't detect anything ( for many reason, I believe), but I realize it happen so fast when normally the proximity would take some times before it changed it state due to the passing product. I think I could "filter" this condition if there is a node, or a function that make me able to give a minimum time before it passing the data to the main function.

Thank you very much.

Edit: In case of raspberry actually I found out that you could use internal resistor ( pull up or Pull down ) on the said pi, to reduce unwanted pulse to the GPIO. However now I realize that the said product actually had a color that actually cannot be detected as obstacle ( BLACK) on the middle side , which result in triggering the pulse twice in one product. The node or function filter might be needed after all).

What is it sending to Node Red - is it a simple high/low 1/0 etc ?

I would suggest look at the filter or trigger nodes as being the closest to your needs

Craig

Well, that was quick lol. Yes the data is either 1 or 0. The trigger nodes works like magic! Thank you very much!!!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.