Reed Swtich Module (KY-025) [S044]



https://www.youtube.com/watch?v=y5TX4BnN1v4


*GitHubhttps://github.com/rdiot/rdiot-s044.git


* Specs

Reed module and the interface comes with digital 13 LED build a simple circuit to produce a Reed warning lamp 13 comes with digital interfaces of the LED, the Reed sensor access number 3 interface, when Reed sensors Sensed a key signal (magnetic field change near the module), LED lights, otherwise off.


* Contents

- Connect

A0 ----- X

G ----- GND

+ ----- 5V

D0 ----- D2


- Key Code

#include <Wire.h> 

#include <LiquidCrystal_I2C.h>


LiquidCrystal_I2C lcd(0x27,20,4);  // LCD2004

int pin = 2;


void setup()

{

  lcd.init();  // initialize the lcd 

  lcd.backlight();

  lcd.print("start LCD2004");


  pinMode(pin,INPUT);

  delay(1000);


  lcd.clear();

}


void loop()

  lcd.setCursor(0,0);

  lcd.print("S044:Read Swtich");


  int val = digitalRead(pin);


  lcd.setCursor(0,1);

  lcd.print("val=" + (String)val + "  ");


  if(val==1)

  {

    lcd.setCursor(0,2);

    lcd.print("detected");    

  }

  else

  {

    lcd.setCursor(0,2);

    lcd.print("        ");    

  }

}

'2) Sensor > Reed' 카테고리의 다른 글

Mini Reed Switch Module (KY-021) [S045]  (0) 2016.09.09
Posted by RDIoT
|