홀 스위치 센서 모듈 -KY-024
(Hall Switch Sensor Module -KY-024)
개요
- 본 제품은 홀 센서 모듈입니다.
- 자기장에 따라 아날로그 전압 출력, 그리고 디지털 출력이 가능한 제품입니다.
- 모듈의 포텐셔미터를 이용하여 디지털 출력의 기준이되는 자기장 값을 설정할 수 있습니다.
특징
- n/a
문서
int Led = 13 ; // define LED Interface int buttonpin = 3; // define the linear Hall magnetic sensor interface int val ; // define numeric variables val void setup () { pinMode (Led, OUTPUT) ; // define LED as output interface pinMode (buttonpin, INPUT) ; // define linear Hall magnetic sensor output interface } void loop () { val = digitalRead (buttonpin) ; // digital interface will be assigned a value of 3 to read val if (val == HIGH) // When the linear Hall sensor detects a magnetic signal, LED flashes { digitalWrite (Led, HIGH); } else { digitalWrite (Led, LOW); } }