DIP switch address and RF CC1101 transceiver Arduino

hey guys, i have a new project for make a new remote control to control the gate using transceiver CC1101. To select the gate i need to create the address for every gate so i can choose the gate i want to get open. I use dip switch to create address on every gate so when i press the push button 1 on remote control, it will open the gate 1. can you tell me how to create the program? and also i was trying to wiring the dip switch and arduino and it not working.Thank you for ur attentions.