How do I figure out the address

How do I figure out the address where I am connecting a device like a compass etc? based on the pins I connect to?

Maybe it's clear to others what address you're referring to, but I have no idea. Perhaps i2c? Generally it's better to give too much information than not enough.

I connected a compass to analog pins 4 and 5 and used the address 0x21 to get the input.

How do pins 4 and 5 translate to address 0x21?

Sorry about not providing all the info the first time

The compass details and code is at

The Arduino board is DUEMILANOVE

I am also using the Mayhew Labs Mux Shield

How do pins 4 and 5 translate to address 0x21

They don't.
Pins 4 & 5 drive a simple serial bus (I2C).
The device 'lives' at a particular address on that serial bus.

second time I see this device coming by today. Good thing I saved the URL :wink:

Read - Compass Module - HMC6352 - SEN-07915 - SparkFun Electronics - there is a datasheet and sample sketches.

Further read these sites to become familiar with I2C protocol

I²C - Wikipedia backgrounder
http://arduino.cc/en/Tutorial/MasterReader

If you are new to Arduino it is allways good to spend time reading the tutoria section too - http://arduino.cc/en/Tutorial/HomePage

Thanks a bunch