Hey! I am on the go here so I will look to your program later...
But in order to "invert" the sensor, all you should need to do is to swap the values of "min" and "max". Set max to 0 and min to 1. That should work for all nodes that have a min and max.
Alternatively you could also connect your sensor to a Converter node. This is particularly useful if you would like your sensor to drive 2 nodes at the same time, but invert the output in one of them - just and a converter in between the sensor and the node, and invert the singal on the converter.
Please let me know if it's not clear, and I will make an example once I am in front of a computer.