Hall Effect Sensor

I'm having some trouble getting a hall effect sensor to work with my arduino.

Here's my code:

int sensor=2; 
int val=0; 
int ledPin=13; 

void setup(){
pinMode(sensor,INPUT);
pinMode(ledPin,OUTPUT);
 Serial.begin(9600);  
}

void loop(){
val=digitalRead(sensor);
Serial.println(val);  // prints hello with ending line break
if(val){
digitalWrite(ledPin,HIGH);
}
else 
digitalWrite(ledPin,LOW);
}

Basically, the value never changes, despite connecting the hall effect sensor to +5v, Pin 2, and GND.
I'm hoping to use this to control my homemade brushless motor/count it's rpms.

Thanks for any help.

Any particular sensor?
Does it have a datasheet?
What sort of a magnet are you using?

What type of Hall Effect sensor are you using? Make sure it is a Hall Effect Switch and not a Linear Hall Effect sensor. I had both in my kit and accidentally used the linear part instead of the switch and the linear sensor never outputted enough signal to trip to a logic high. Swapped to the switch and it worked fine.

I had no idea there were multiple types.
Here's the data sheet

it says sensor, not switch.

It's a latch - so when a south pole passes the sensor it switches on; and when a north pole passes it switches off.

Therefore, you either need both ends of a magnet to pass the sensor to make it toggle (off-on-off), or 2 magnets, one after the other. See sections 8 & 10 in the datasheet.

You also need to tie the output to Vcc (or Vss as they call it) through a resistor - see section 13 in the datasheet. My hall switch needs a similar pull-up resistor (http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1274834441); without that resistor it probably can't pull itself high again after a magnetic north has supposedly un-latched it.