Schematic Diagram:
How to Test:
1. Connect your Arduino microcontroller to the computer.
2. Connect the VCC pin of your module to the to the 5V pin of your Arduino.
3. Connect the GND pin of your module to the GND pin of your Arduino.
4. Connect the Output pin of your module to the A0 pin of you Arduino.
5. Enter this program to your Arduino Integrated Development Environment (IDE):
boolean STATUS = false;
void setup()
{
Serial.begin(9600);
}
void loop()
{
while (digitalRead(A0))
{
if (STATUS) Serial.println("ON");
else Serial.println("OFF");
delay(100);
}