Calculate sensor unique address with a 8 position DIP Switch
Assuming that your switches are on pins 2-9 on an UNO.  Change pins to match what you actually have. 

byte addressVal = 0;
for(int i = 2: i&lt;10; i++){
    addressVal &lt;&lt;= 1;
    addressVal += digitalRead(i);
}


This will check each switch and add a 1 to the end of the byte.  On each iteration it shifts the contents of that byte 1 place to the left.  After it reads all the pins you have a byte with a value 0 to 255 depending on the states of the pins.