 
   Serial.begin (19200);
 
-  Serial.print("Connecting to ");
-  Serial.print(ssid);
-  WiFi.begin(ssid, password);
-  while (WiFi.status() != WL_CONNECTED) {
-    delay(500);
-    Serial.print(".");
-  }
-  Serial.println("");
-  Serial.println("WiFi connected");
-  Serial.print("IP address: ");
-  Serial.println(WiFi.localIP());
-
-  pinMode(encPinA, INPUT_PULLUP);
-  digitalWrite(encPinA, HIGH);
-  lastEncPinAVal = digitalRead(encPinA);
-
-  pinMode(encPinB, INPUT_PULLUP);
-  digitalWrite(encPinB, HIGH);
+  initHardware();
+  initWiFi();
 
 }
 

      //We want to change the stream when the timer expires,
      //unles the rotary is in the same position we started
      if (strIndex != playingStrIndex) {
        sendStreamChange();
        playingStrIndex = strIndex;
      }
    }

#include "constants.h"

//Rotary pins
const int encPinA = D1;
const int encPinB = D2;

//Delay for unsupervised stream change
int strChangeDelay = 750;
