Retain value for 30s or more even if its changes

I have an application with a vision sensor and some semi-finished products of different color. How do I retain the sensor value for a longer time? I have a shelf and a stacker craner that I use but I don’t know which function to use.