Вернуться на страницу библиотеки модулей
// Arduino and KY-024 module
void setup ()
{
pinMode (13, OUTPUT); // built-in LED pin set to output
pinMode (8, INPUT); // module digital output connected to Arduino pin 8
Serial.begin(9600); // initialize serial
}
void loop ()
{
Serial.print("Analog pin: "); // display analog and digital values to serial
Serial.print(analogRead(A0));
Serial.print(" | Digital pin: ");
if (digitalRead(8) == HIGH) {
Serial.println("High");
digitalWrite (13, HIGH); // if magnetic field is higher than threshold , switch-On built-in LED
}
else {
Serial.println("Low");
digitalWrite (13, LOW);
}
delay(100); // wait 100 milliSeconds
}
Рекоменв
Arduino Linear Hall Sensor KY-024 — Pinout, Wiring & Code
Using the Linear Magnetic Hall Sensor KY-024 with Arduino – Phipps Electronics
KY-024 Linear, magnetic hall sensor – SensorKit
Discover 7 Powerful Uses of the KY-024 Magnetic Sensor
KY-024 JOY-IT | Alldatasheet
Hall Magnetic Sensor Module(KY-024) – ArduWiki : Arduino Hall Magnetic Sensor Module (KY-024) Guide