• Part: KY-021
  • Description: Mini magnetic Reed module
  • Manufacturer: Joy-IT
  • Size: 357.72 KB
Download KY-021 Datasheet PDF
Joy-IT
KY-021
KY-021 is Mini magnetic Reed module manufactured by Joy-IT.
- Part of the KY-021-Joy comparator family.
KY-021 Mini magnetic Reed module KY-021 Mini magnetic Reed module Contents 1 Picture ................................................................................................................................................................. 1 2 Technical data / Short description ....................................................................................................................... 1 3 Pinout ................................................................................................................................................................... 2 4 Code example Arduino ......................................................................................................................................... 2 5 Code example Raspberry Pi ................................................................................................................................. 3 Picture Technical data / Short description If the sensor is close to a magnetic field, the input pins are connected. Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 86 of 214 KY-021 Mini magnetic Reed module Pinout Code example Arduino This example will activate a LED if the sensor is close to a magnetic field. The modules KY-011, KY-016 or KY-029 can be used as a LED. int Led = 13 ;// Declaration of the LED output pin. int Sensor = 10; //Declaration of the sensor input pin int val; // Temporary variable void setup () { pin Mode (Led, OUTPUT) ; // Initialization output pin pin Mode (Sensor, INPUT) ; // Initialization sensor pin } void loop () { val = digital Read (Sensor) ; // The current signal at the sensor will be read if (val == HIGH) // If a signal will be detected, the LED will light up. { digital Write (Led, LOW); } else { digital Write (Led, HIGH); } } Connections Arduino: LED + LED Sensor Signal Sensor +V = [Pin 13] = [Pin GND] = [Pin 10] = [Pin 5V] Export: 16.06.2017 Copyright by Joy-IT - Published under CC BY-NC-SA 3.0 Page 87...