Mini Reed Switch Module Arduino Compatible
ARD2-2221
$3.95
QTY | Price |
---|---|
1 | $3.95 |
Description
The Mini Reed Switch Module uses a sensor that reacts to a magnetic field. It includes a 10K ohm resistor and a small switch reed switch actuated by a magnetic field.
This Mini Reed Switch Module activates a switch closure when exposed to a magnetic field and remains open without 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.
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.