I don't believe your code will work correctly as designed right now.
You actually have quite a few problems.
1st, in
BLUE. The In Range / Coerce function is very useful and is exactly what you want for this logic, but... what about numbers between say 15 and 16, 24 and 25, 38 and 39, or 44 and 45? The way you have it setup is almost perfect because of the solid diamond on the bottom (include the value and all values above) and the hollow diamond at the top (include all values below, but not the value). So you need to decide on one of the two numbers. So instead of 15 and 16, you need to either have just 15 or just 16 for both of them. Otherwise you have a gap in your logic.
2nd, in
PINK. The red dot in the code means you're doing a coercion, or that you are converting from one data type to another without explicitly meaning to. This may be fine for your use, as long as the number is EXACTLY what you specify. If it's somewhere between say 4 and 5... which one should it pick? If there's no need for decimal points (floating point arithmetic), then take it out. It only slows down the code, uses more memory, and complicates your code.
3rd, in
GREEN. Two problems here. You have an unthrottled while loop... while it's waiting on your DIO to return a value, it will just sit there in a loop, waiting, going as fast as it can, using all available CPU time. But that doesn't matter because you
CANNOT place an undeterministic 'while' loop in the Teleop VI. This is a HUGE no no. This will cause all other functions in teleop to become unresponsive while the lift motor is running. Still... even with all of this, you have an even bigger problem...
4th, in
ORANGE. This loop will never terminate because the DIO input will never be updated within the loop. Once the while loop begins, it gets stuck there, forever. Hence why it's such a HUGE no no to have a while loop in teleop. In this case, your robot would cease to function because it would get stuck in this while loop. If (and I strongly discourage it) you stuck with this while loop in teleop, you need to have the DIO Get function inside of the while loop. That way, it can update and terminate the while loop once the motor is done moving.
5th, in
RED... what are you trying to do here? Are you trying to selectively get the reference to your DIO input? Don't you already know what desired level you want because of the case structure that was partically circled in
PINK a moment ago? Why complicate your code like this?
