Pages: [1]   Go Down
Author Topic: Switch case problems  (Read 360 times)
0 Members and 1 Guest are viewing this topic.
Norway
Offline Offline
Jr. Member
**
Karma: 0
Posts: 79
<3 Arduino
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
 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 ?
Logged

I'm from Norway!

0
Offline Offline
Faraday Member
**
Karma: 8
Posts: 2526
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

-j

Logged

Pages: [1]   Go Up
Jump to: