Hall Magnetic Sensor Module(KY-024): 두 판 사이의 차이
(Created page with "{{#seo:|title=아두위키 : 아두이노 홀 자기 센서 모듈(KY-024) 가이드|title_mode=append|keywords=아두이노, 정보과학, 메이커학습, 수행평가, 홀 자기 센서 모듈(KY-024), 아두이노 작품, 캡스톤작품, 아두이노 예제코드|description=아두이노로 홀 자기 센서 모듈(KY-024)을 제어하는 방법(기본정보, 회로, 예제 코드)을 소개합니다. 정보과학과 메이커수업에 활용가능합니다.}} Fil...") |
(차이 없음)
|
2024년 3월 24일 (일) 15:58 판

The KY-024 is a magnetic sensor module that offers both digital and analog outputs. It features an adjustable sensitivity via a potentiometer.
Specifications
- Operating Voltage: 3.3V ~ 5V
- Output Type: Digital, Analog
Example Required Hardware
- Arduino board
- Jumper cables
- Hall magnetic sensor module (KY-024)
Connection
| Arduino | KY-024 Hall magnetic sensor module |
| A0 | AO |
| D12 | DO |
| 3.3V | + |
| GND | G |

Example Code
The example demonstrates how to read values from the Hall magnetic sensor, outputting them in both analog and digital formats.
const int analogPin = A0;
const int digitalPin = 12;
void setup() {
pinMode(digitalPin, INPUT);
}
void loop() {
int valap = analogRead(analogPin);
int valdp = digitalRead(digitalPin);
Serial.print(valap);
Serial.print("\t");
Serial.println(valdp);
delay(100);
}
Execution Results
- When no magnet is present around the module

- When a magnet is present around the module
