Moderately new to arduino. My first post here. Not my first project, and I'm typically capable of understanding and digging around until I figure out why things are not working and how to make them work, but this seemingly refuses to work logically. Or maybe I'm crazy... Not sure yet.

manifold - input from sensor that's translated to a value that is from -10 to 15. (logic within this works perfectly, in use with another project that's live.)

counter - controlled by two buttons for up/down. Range of values is limited to 5 through 10, starts by default at 5. pressing one button adds one, and it stays. vice versa for the other button. (working perfectly.)

dutyValue - currently an irrelevant number referenced purely for seeing which if() statement is being activated (printed on a OLED display), but will eventually be a logical duty cycle value.

Whats happening:

If manifold = 4.2, then dutyValue = 245.

If manifold = 5.3, then dutyValue = 245.

If manifold = 7.6, then duty value = 247.

it will follow the counter. if i change counter to 6 - 10, then it follows the respective duty within the 245-250 outputs

why is it disregarding the very first group of code?

if I comment out the "manifold > 5 line", then it jumps to the next one and outputs 246.

i realize its very likely that there is error in my logic, but i cant exactly figure out what.

if its not evident what I'm after...

if manifold sees 6, counter is on 5, duty cycle sent to solenoid to bring manifold to 5.

if manifold sees 15, counter on 5, duty cycle sent to solenoid to bring manifold to 5.

if manifold sees 5, counter on 8, duty cycle sent to solenoid to bring manifold to 8.

Basically controlling solenoid via duty cycle to bring manifold to the specified value by the counter.

The ultimate goal is to ONLY show 246 when manifold is between 6 and 6.9, and so on respectively. if its above 6.9, and counter is on 5, then duty cycle will drop to shut off adding manifold pressure.

```
if (manifold < 5 && counter == 5) {dutyValue = 5;}
if (manifold < 6 && counter == 6) {dutyValue = 6;}
if (manifold < 7 && counter == 7) {dutyValue = 7;}
if (manifold < 8 && counter == 8) {dutyValue = 8;}
if (manifold < 9 && counter == 9) {dutyValue = 9;}
if (manifold <10 && counter ==10) {dutyValue = 10;}
if (manifold > 5 && manifold < 5.9 || counter == 5) {dutyValue = 245;}
if (manifold > 6 && manifold < 6.9 || counter == 6) {dutyValue = 246;}
if (manifold > 7 && manifold < 7.9 || counter == 7) {dutyValue = 247;}
if (manifold > 8 && manifold < 8.9 || counter == 8) {dutyValue = 248;}
if (manifold > 9 && manifold < 9.9 || counter == 9) {dutyValue = 249;}
if (manifold > 10 || counter == 10) {dutyValue = 250;}
```

What am I doing wrong? I've also tried the code below, and a few other things, but makes no difference. Am I asking too much of the if() with having so much going on and different ranges? If i comment out the 2nd group of ifs, then the first set works exactly as expected.

I'm sorry if this is confusing. I imagine there may be other ways to do this, but this made some sort of sense in my head. My luck I'm probably completely out in left field somewhere and there's a super simple and logical solution that'll take 5 minutes to code.

```
if (5 > manifold < 5.9 || counter == 5) {dutyValue = 245;}
```