How to Use 2pices Reed Switch?

How can i use switch case ??
reedSwitch1 check, serial monitor Num1
reedSwitch2 check, serial monitor Num2 like this… plz help me

This is my code : 웃음 소리 :

#include <avr/sleep.h>

const int reed1 = 2;
const int reed2 = 3;

const byte LED12 = 12;
const byte LED13 = 13;

void setup() {
pinMode(reed1, INPUT_PULLUP);
pinMode(reed2, INPUT_PULLUP);

pinMode(LED12, OUTPUT);
pinMode(LED13, OUTPUT);
Serial.begin(9600);

}

void loop() {

int range = map(read1, read2);

switch(range){
case 1:
if(digitalRead(reed1) == LOW){
digitalWrite(LED12, HIGH);
}else{
digitalWrite(LED12,LOW);
Serial.println(“Num1 Check”);
break;
}
case 2:
if(digitalRead(reed2) == LOW){
digitalWrite(LED12, HIGH);
}else{
digitalWrite(LED13,LOW);
Serial.println(“Num2 Check”);
break;
}
}
}

int range = map(read1, read2);

That's not how the map() function works. You also have two new variable names there that aren't declared in the sketch. When you wrote "read1" did you mean "read the value of pin reed1"? Or something else?

The case statement makes no sense. If that did work, you just examine the value of one or the other switch. (Although the second one is trying to turn on the LED associated with the first one.) Except the break; is inside part of the else clause so sometimes it will break and sometimes it won't.

const int reed1 = 2;
const int reed2 = 3;

const byte LED12 = 12;     
const byte LED13 = 13;

This numbering scheme boggles the mind. Two reed switches, numbered 1 and 2, makes sense. Two LEDs, numbered 12 and 13, does not.

It looks like you have a homework assignment that involves using a switch statement. There appears to be no other reason, based on the code in the case statement, to have used a switch statement. So, why did you?