Skip to main content

Menu

Mini Reed Switch Module Arduino Compatible

ARD2-2221
Arduino Compatible ARD2 Mini Reed Switch Module

$3.95

QTYPrice
1 $3.95

Description

A reed module is a magnetic sensor that is normally open and closes when exposed to a magnetic field. In the test code below, the built-in LED on pin 13 flashes if the sensor is closed. A magnet must be near the sensor to close the switch. The module includes a 10K Ohm resistor, so no additional parts are needed.

Test Code

// Example code for sensor KY021
// More info on http://tkkrlab.nl/wiki/Arduino_KY-021_Mini_ magnetic_reed_modules

int Led = 13; // define LED Interface
int buttonpin = 3; // define the Reed sensor interfaces
int val; // define numeric variables val

void setup() {
pinMode(Led, OUTPUT); // define LED as output interface
pinMode(buttonpin, INPUT); // output interface as defined Reed sensor
}

void loop() {
val = digitalRead(buttonpin); // digital interface will be assigned a value of 3 to read val

// When the Reed sensor detects a signal, LED flashes
if (val == HIGH) {
digitalWrite(Led, HIGH);
}
else {
digitalWrite(Led, LOW);
}
}

Features

  • Completes circuit when a magnetic field is detected
  • No additional parts required

Specifications

Board Colour

Black

Material

PCB

Resources

You Might Also Like

All prices are in Australian Dollars and include GST. GST will be removed from your order if you are ordering from outside Australia.
Products may differ from pictured.
All trademarks and trade names are the properties of their respective owners. Wiltronics disclaims any proprietary interest in trademarks and trade names other than its own.

Mini Reed Switch Module Arduino Compatible

ARD2-2221

$3.95

We use cookies to ensure you have the best experience on our site. If you continue to use this site you consent to the use of these cookies. OK

Find out more in our Privacy Policy