Go Down

Topic: Switch case problems (Read 390 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
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy