         case 4:
             initState++;
             rbc_mesh_value_enable((uint8_t) 2);
+            initDone = 1;
             Serial.println("init done");
     }
 }
 
 
 void loop() {
-    initConnectionSlowly();
-
+    if(!initDone){
+        initConnectionSlowly();
+    }
     //Process any ACI commands or events
     hal_aci_data_t evnt;
     newMessage = rbc_mesh_evt_get(&evnt);

  pins.interrupt_number       = 1;

  rbc_mesh_hw_init(&pins);
 
  Spark.function("set_val", set_val);
  Spark.variable("tmp", &tmp, INT);

  return;
}

  pins.miso_pin   = A4;
  pins.sck_pin    = A3;

  pins.spi_clock_divider      = SPI_CLOCK_DIV16; //SPI_CLOCK_DIV8  = 2MHz SPI speed
                                                 //SPI_CLOCK_DIV16 = 1MHz SPI speed
                                                 //if you are having trouble with the connection this might be the reason
                                                 //you might want SPI_CLOCK_DIV64 = 256 KHz

  pins.reset_pin              = D2; //4 for Nordic board, UNUSED for REDBEARLAB_SHIELD_V1_1
  pins.active_pin             = NRF_UNUSED;
  pins.optional_chip_sel_pin  = NRF_UNUSED;
