const int hallPin = A0; // hall effect sensor out pin int hallState = 0; // Initial hall sensor status void setup() { Serial.begin(9600); // The hall effect sensor pin as an input pinMode(hallPin, INPUT); } void loop(){ hallState = analogRead(hallPin); // reading the state of the hall effect sensor pin Serial.println(hallState); Serial.println("detect"); // delay(200); }