  *  GND        GND
  *  VCC        VCC
  *  GPIO15     NSS
- *  GPIO12     MOSI
- *  GPIO13     MIS0
+ *  GPIO13     MOSI
+ *  GPIO12     MIS0
  *  GPIO14     SCK
  *  GPIO5      DIO0
  *  GPIO4      DIO1

}

void goToSleep() {
  Serial.print("Up time "); Serial.print(millis());
  Serial.print(", going to sleep for "); Serial.print(SLEEP_SECONDS); Serial.println(" secs");
  ESP.deepSleep(SLEEP_SECONDS*1000000, RF_DISABLED);  
}

// LoRaWAN NwkSKey, network session key
// This is the default Semtech key, which is used by the prototype TTN
// network initially.
static const PROGMEM u1_t NWKSKEY[16] = { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C };

// LoRaWAN AppSKey, application session key
// This is the default Semtech key, which is used by the prototype TTN
// network initially.
static const u1_t PROGMEM APPSKEY[16] = { 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C };

void lmicInit() {
  Serial.print("LMIC Init started at "); Serial.print(millis()); Serial.print("...");

    LMIC_setLinkCheckMode(0);

    // Set data rate and transmit power (note: txpow seems to be ignored by the library)
    LMIC_setDrTxpow(DR_SF7, 20);

  // only use channel 0 for the single channel gateway
  LMIC_disableChannel(1);
