moonshine_andrew
Published © GPL3+

Reed switch on a wicket gate

You don't know if your gate are closed or not? with a simple IP65 reed switch and a buzzer now you can.

BeginnerFull instructions provided125
Reed switch on a wicket gate

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Reed Switch, SPST-NO
Reed Switch, SPST-NO
×1
Plastic Enclosure, Junction Box
Plastic Enclosure, Junction Box
×1
Buzzer
Buzzer
×2
LED (generic)
LED (generic)
×2
Resistor 10k ohm
Resistor 10k ohm
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

reed_bb_oMR7AXLfjw.png

Code

Untitled file

Arduino
// Contatto Reed per cancello - AM2021
  
  const int REED = 12;
  const int LED_cucina = 9;
  const int LED_caldaia = 10;
  
  const int buzzer_cucina = 6 ;
  const int buzzer_caldaia = 7;

  int stato_REED = 0;

void setup()
{
  pinMode(LED_cucina, OUTPUT);
  pinMode(LED_caldaia, OUTPUT);
  
  pinMode(buzzer_cucina,OUTPUT);
  pinMode(buzzer_caldaia,OUTPUT);

  pinMode(REED, INPUT);
}
void loop()
{
  stato_REED = digitalRead(REED);
  if (stato_REED == HIGH)
   {
      digitalWrite(LED_cucina, LOW);
       digitalWrite(LED_caldaia, LOW);
   }
else
  {
     digitalWrite(LED_cucina, HIGH);
     digitalWrite(LED_caldaia, HIGH);  
  
     tone(buzzer_cucina,1000,200);
     delay(500);                      
     noTone(buzzer_cucina);              
     delay(500);
  
     tone(buzzer_caldaia,1000,200);
     delay(500);
     noTone(buzzer_caldaia);              
     delay(500);
  }
  delay (500);
}

Credits

moonshine_andrew
0 projects • 0 followers
Contact

Comments

Please log in or sign up to comment.