Pro Micro and KY-024 HALL module - TEST?

I try to test this HALL module both digital and analog - no luck at all !

I use the code from the datasheet changed for correct pins - not sure about 13.

No LED is changing when magnet is moved to/from the sensor !
The analog value is changing a little from 1023 most of the time to 1020-1021 when magnet is moved.

The on KY-024 board trim pot. can be turned and turned but nothing happens !

What do I do wrong ?

int led = 13 ; // LED on arduino
int digitalPin = 9; // linear Hall magnetic sensor digital interface
int analogPin = A3; // linear Hall magnetic sensor analog interface
int digitalVal ; // digital readings
int analogVal; // analog readings

void setup ()
  pinMode (led, OUTPUT); 
  pinMode (digitalPin, INPUT); 
  pinMode(analogPin, INPUT); 

void loop ()
  // Read the digital interface
  digitalVal = digitalRead(digitalPin) ; 
  if (digitalVal == HIGH) // When magnetic field is present, Arduino LED is on
    digitalWrite (led, HIGH);
    digitalWrite (led, LOW);
  // Read the analog interface
  analogVal = analogRead(analogPin);
  Serial.println(analogVal); // print analog value


Do you have a second one to test?

Code looks ok, so I suspect wiring or hardware.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.