Mosaic
Well-Known Member
Hi,
I'd like to evaluate a voltage ladder sampled by an adc to determine a tactile switch press.
Here's what i have:
It's not evaluating the ranges properly. In the 1st case, only if the >140 fails does it evaluate the < 150. It's using the parameters as an 'OR" I need an 'AND'.
How can I do this?
I'd like to evaluate a voltage ladder sampled by an adc to determine a tactile switch press.
Here's what i have:
Code:
Select Case tactile 'assign a swich based on the voltage detected.
Case > 140, < 150 ' need to evaluate an adc range of 140 to 150.
swstate.0 = 1 'sw 0 closed
Case > 130, < 140
swstate.1 = 1 'sw 1 closed
Case > 120, < 130
swstate.2 = 1 'sw 2 closed
Case > 105, < 115
swstate.3 = 1 'sw 3 closed
Case Else
EndSelect
It's not evaluating the ranges properly. In the 1st case, only if the >140 fails does it evaluate the < 150. It's using the parameters as an 'OR" I need an 'AND'.
How can I do this?