TLE4905L Hall Effect sensor help

Hi everyone,

I have a TLE4905L hall effect sensor and I cannot get the arduino to receive a signal. I have all the wiring wired correctly according to the data sheet (pin 1 = +5v, pin 2 GND, pin 3 = output).

I wrote this extremely simple program to see the reading when I pass a magnet over it. Can someone please help me?

int halfx;

void setup() 
{
pinMode(INPUT_PULLUP, 32);
Serial.begin(9600);
}

void loop() 
{

if(digitalRead(halfx) == LOW)
{
  Serial.println("halfx is ON");
}

if(digitalRead(halfx) == HIGH)
{
  Serial.println("halfx is OFF");
}
}

Hello,

You didn't assign a value to halfx.

pinMode(INPUT_PULLUP, 32) is not valid, it's pinMode( pin, mode )

pinMode(INPUT_PULLUP, 32);

The pin number goes first. The mode goes second.

My bad. Just fixed that and still can't get it to work.

Just fixed that

"That" being which error?

Hey guys,

I solved my problem. I must have gotten a manufacturer defect. I placed the hal sensor on a breadboard and made a small circuit to light an LED when a magnet was placed next to it.

Turns out that,although my hal sensor is marked as a TLE4905L, the pinout on the data sheet is wrong. Pin 2 and 3 are switched in my hal sensor. Very odd problem.

Hopefully this helps someone i the future and keeps them from chasing their tail.