1 x Hall Effect Sensor 1 x Arduino Uno 1 x 10K Ohm Resistor 1 x LED jumper wires
#define HS 4 #define LED 13 void setup() { pinMode(LED, OUTPUT); Serial.begin(9600); pinMode(HS, INPUT); digitalWrite(HS, HIGH); // activate internal pullup } void loop() { Serial.println(digitalRead(HS)); if(digitalRead(HS) == LOW) { digitalWrite(LED, HIGH); delay(100); // simple debounce } else { digitalWrite(LED, LOW); delay(100); } }