thanks.Unfortunately I did not understand the StateChangeDetection example Can you look at my code and edit it?