





| รหัสสินค้า | AS10232 | 
| หมวดหมู่ | Magnet/Magnetic Switch | 
| ราคา | 30.00 บาท | 
| สถานะสินค้า | พร้อมส่ง | 
| จำนวน | ชิ้น  | 
| Operating Voltage | 3.3V to 5v | 
| Output Type | Digital | 
| KY-021 | Arduino | 
| S | 2 | 
| middle | +5V | 
| - | GND | 

The following sketch will turn on the pin 13 LED on the Arduino when the module detects a magnetic field. Place a magnet near the KY-021 to activate the reel switch.
int led = 13; // LED pin
int reelSwitch = 2; // magnetic sensor pin
int switchState; // variable to store reel switch value
void setup()
{
pinMode (led, OUTPUT);
pinMode (reelSwitch, INPUT);
}
void loop()
{
switchState = digitalRead(reelSwitch); // read the value of digital interface 2 and assign it to switchState
if (switchState == HIGH) // when the magnetic sensor detect a signal, LED is flashing
 {
digitalWrite(led, HIGH);
}
else
{
digitalWrite(led, LOW);
}
}






ชำระเงินค่าสินค้าโดยการโอนเงินเข้าบัญชีธนาคาร KBANK, SCB, BBL,TMB
กรุณาเก็บหลักฐานการโอนเงินของท่านไว้เพื่อแจ้งการชำระเงินด้วยค่ะ
ท่านสามารถแจ้งการชำระเงินผ่านระบบอัตโนมัติได้โดย Click Link ข้างล่างค่ะ
https://www.arduitronics.com/informpayment
| หน้าที่เข้าชม | 15,463,546 ครั้ง | 
| ผู้ชมทั้งหมด | 5,966,624 ครั้ง | 
| เปิดร้าน | 21 พ.ค. 2556 | 
| ร้านค้าอัพเดท | 4 พ.ย. 2568 |