   pinMode(3,OUTPUT);
   digitalWrite(3,LOW);
   sensors.begin();
-  
+
+  // Set up mux
+  for (int i=0; i<3; i++)
+  {
+    pinMode(muxPins[i], OUTPUT);
+    digitalWrite(muxPins[i], LOW);
+  }
+  pinMode(muxOutPin, INPUT);
+
 }
 
 void sendRadioMessage(String s){
   char msgChar[100];
   s.toCharArray(msgChar,100);
   radio.write(&msgChar,sizeof(msgChar));
+}
+
+void selectMuxPin(byte pin) {
+  if(pin >7){
+    return;
+  }
+
+  digitalWrite(muxPins[0], bitRead(pin,0));
+  digitalWrite(muxPins[1], bitRead(pin,1));
+  digitalWrite(muxPins[2], bitRead(pin,2));
 }
 
 void loop() {


/* Analog */
const int lightSensorPin = 0;
const int m1Pin = 1;
const int m2Pin = 2;
const int m3Pin = 3;

/* Digital */
const int tempSensorPin = 2;

// Setup a oneWire instance to communicate with any OneWire devices 
// (not just Maxim/Dallas temperature ICs)
OneWire oneWire(tempSensorPin);
 
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);


  sensors.requestTemperatures();
  temp = sensors.getTempCByIndex(0);

  String muxMessage = "";
  for(byte pin=0;pin<8;pin++){
    selectMuxPin(pin);
    int pinValue = analogRead(muxOutPin);
    muxMessage += String(pin+5) + ":" + pinValue + ",";
  }

  digitalWrite(3,LOW);
  String lightMsg = String(LIGHT_SENSOR_ID) + ":" + lightLevel;
  String tempMsg = String(TEMP_SENSOR_ID) + ":" + temp;

  sendRadioMessage(muxMessage+lightMsg+","+tempMsg);
  delay(600000);

}