 #define MODE_ON     1  // not sensing light, LED on
 #define MODE_SENSE  2  // sensing light, LED controlled by software
 int senseMode = 0;
-//char message_buff[100];
-
+char message_buff[100];
+//setup MQTT
 WiFiClient wifiClient;
-//setup MQTT
+//MQTT
 PubSubClient client(serverRabbit, port, callback, wifiClient);
   
 void setup() {
   // initialize serial and wait for the port to open:
   Serial.begin(9600);
   while (!Serial);
+  
   connectToWifi();
+  
   // set the LED pins as outputs
   // the for() loop saves some extra coding
   for (int pinNumber = 2; pinNumber < 5; pinNumber++) {


void loop() {
  Serial.println("DEBUG :: loop()");
  String temp = readTemperature();
  Serial.print("DEBUG :: Temp value return is : ");
  Serial.println(temp);
  String humidity = getDHT11HumidityReadings();
  Serial.print("DEBUG :: Humidity value return is : ");
  Serial.println(humidity);
  checkTiltState() ;
  publishTempHumMsg(temp, humidity);
  // MQTT client loop processing
  client.loop();
}

void connectToMQTT() {
    Serial.println("INFO :: Connecting to RabbitMQ");
    if (client.connect(clientName, user, pwd)) {
      Serial.println("INFO :: Connected to RabbitMQ");
    } else {
      Serial.println("ERROR :: Failed to Connect to RabbitMQ");
    }
}

void checkTiltState() {

  Serial.print(hi);
  Serial.println(" *F");
  delay(500);
 return h;
}

float readTemperature() {
  // read the value on AnalogIn pin 0 and store it in a variable
  int sensorVal = analogRead(sensorPin);
  // send the 10-bit sensor value out the serial port
