Go Down

Topic: Switch case problems (Read 377 times) previous topic - next topic

Stigern

Code: [Select]

 switch (Selectverdi)
    {
      case > 100 && < 200:
      digitalWrite(pins[12], HIGH);
      digitalWrite(pins[11,10,9,8,7,6,5,4,3,2,1], LOW);
      Mode = 1;
      break;
     
      case > 200 && < 300:
      digitalWrite(pins[11], HIGH);
      digitalWrite(pins[12,10,9,8,7,6,5,4,3,2,1], LOW);
      Mode = 2;
      break;
      default:
      break;
    }


How can I do that?
To make it check if the case is between 100 & 200 ?
I'm from Norway!

kg4wsv

switch/case is for discrete values.  you need an if else if block.

-j


Go Up