'2) Sensor/Reed'에 해당되는 글 2건

  1. 2016.09.09 Mini Reed Switch Module (KY-021) [S045]
  2. 2016.09.09 Reed Swtich Module (KY-025) [S044]

Mini Reed Switch Module (KY-021) [S045]



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


*GitHub : https://github.com/rdiot/rdiot-s045.git


* Specs

A reed module is a magnetic sensor that is normally open and get closed when exposed to a magnetic field.

In our example turn off the buildin LED on pin 13 if the sensor is closed. For this you need to keep a magnet near the sensor.

The module includes a 10 K Ohm resistor, so no additional parts needed.


* Contents

- Connect

S ----- D2

Middle ----- 5V

- ----- GND


- 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("S045:Mini ReadSwtich");

 

  int val = digitalRead(pin);

 

  lcd.setCursor(0,1);

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

 

  if(val==LOW)

  {

    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
Reed Swtich Module (KY-025) [S044]  (0) 2016.09.09
Posted by RD IoT RDIoT

댓글을 달아 주세요

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
Reed Swtich Module (KY-025) [S044]  (0) 2016.09.09
Posted by RD IoT RDIoT

댓글을 달아 주세요