Connect magnetic sensor to Arduino

I'm not sure what kind of "magnetic sensor" you are expected to use. There exist transistor-shaped 3-legged Hall sensors, with digital or analog outputs just as you like, which require not more than (eventually) a pullup resistor. Also available are 3DOF compass modules, for use with the earth or similarly weak magnetic fields.