eunhee하람 이지호gledel
Published © GPL3+

Let's Close the Door

A device for solving problems that children do not close the door. I used a magnet and digital magnetic sensor.

BeginnerShowcase (no instructions)4 hours1,267
Let's Close the Door

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Jumper wires (generic)
Jumper wires (generic)
×1
3D Magnetic Sensor 2Go
Infineon 3D Magnetic Sensor 2Go
×1
9V battery (generic)
9V battery (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Custom parts and enclosures

massage box

Schematics

20180419_214423_y1xqV0FVs8.jpg

Code

magnetic sensor

Arduino
#include <Wire.h>
const int magPin=3;
const int ledPin = 13;
const int buzzerPin = 12;


void setup()
{
 Serial.begin(9600);
 Serial.println("magnet:");
 pinMode(magPin,INPUT);
 pinMode(ledPin, OUTPUT);
pinMode(buzzerPin, OUTPUT);
}
 int val;
 
 
void loop()
{
  
  
  int magStatus = digitalRead(magPin);
  
  val=digitalRead(magPin);
  Serial.println(val);
  
  
if (magStatus==HIGH){

tone(buzzerPin, 100);

digitalWrite(ledPin, HIGH);

delay(100);

noTone(buzzerPin);

digitalWrite(ledPin, LOW);

delay(100);

}

else {

noTone(buzzerPin);

digitalWrite(ledPin, LOW);

}


}

Credits

eunhee
3 projects • 1 follower
Contact
하람 이
1 project • 0 followers
Contact
지호
1 project • 0 followers
Contact
gledel
100 projects • 116 followers
Looking back on my childhood, I was happy when I was making something and I was proud of myself. "Making is instinct!"
Contact

Comments

Please log in or sign up to comment.