So I am doing a project for school in which there are 3 input switches that control 8 LED lights. Each binary combination of the 3 switches will do something different (000 lights up all of them, 001 lights up every other one, etc). Is there a way to string these three binary values together into one binary number which can also be stored as a decimal integer? I tried using the bitWrite, but I can't get it to work correctly. I tried using a switch loop on the variable created out of the binary inputs (case 0, case 1, case 2, case 3.... case eight ) but that didn't work correctly. I know I could get it to function other ways, such as treating each binary input as a separate variable, but I want to make this as efficient as possible.
//Lab 8
//Pin Initialization
int sw1 = 13; //Switches 1-3
int sw2 = 12;
int sw3 = 11;
int r1 = 3; //Right blinkers
int r2 = 2;
int r3 = 1;
int r4 = 0;
int l1 = 4; //Left blinkers
int l2 = 5;
int l3 = 6;
int l4 = 7;
void setup() {
pinMode(r1, OUTPUT); //Right and left blinkers
pinMode(r2, OUTPUT); //Are outputs (blue wires)
pinMode(r3, OUTPUT);
pinMode(r4, OUTPUT);
pinMode(l1, OUTPUT);
pinMode(l2, OUTPUT);
pinMode(l3, OUTPUT);
pinMode(l4, OUTPUT);
pinMode(sw1, INPUT); //Switches are inputs
pinMode(sw2, INPUT); //(green wires)
pinMode(sw3, INPUT);
}
void loop() {
int input;
bitWrite(input,0,digitalRead(sw1)); //Set bit values for
bitWrite(input,1,digitalRead(sw2)); //input starting with LSB
bitWrite(input,2,digitalRead(sw3)); //(input,bit,value from sw1
}

