Ok, thanks for the example code.
If this is not clear enough I can give you an example based on the Raspberry Pi GPIO (but that is atm not very clean, since I change it too much and it is not under version control, unlike most of my code)
It is clear enough, so more examples will not be needed for me. Unless for others interesting.
I know how sets work and I use their functionality myself. I was just curious about why you declared a set of logical values in your example. I could not come up with the sense of such a collection.