Manual

Example Application
The following example uses the Reed Module to control a connected
LED.
The instructions use the Arduino® platform to illustrate product
use. You can also use an Arduino derivative or another platform
that supports this type of product.
Connection
Module S + -
Arduin ~3 5V GND
Code
// Define numeric variables val
int val;
// Define LED Interface
int Led = 13;
// Define the Reed sensor interfaces
int buttonpin = 3;
void setup () {
// Define LED as output interface
pinMode (Led, OUTPUT) ;
// Output interface as defined Reed sensor
pinMode (buttonpin, INPUT) ;
}
void loop () {
// Digital interface will be assigned a value of 3
to read val
val = digitalRead (buttonpin) ;
// When the Reed sensor detects a signal, LED
flashes
if (val == HIGH) {
digitalWrite (Led, HIGH);
}
else {
digitalWrite (Led, LOW);
}
}
2