 #define slotNumber 1 //This will vary for multi slot devices - dash buttons typically only serve one product/slot
 
 const int dashButton = 14;     //DIO number of the pushbutton pin
-static long buttonHigh = 0;    //millis of last button push for switch debouncing
-static String slotStatus = ""; //boolean which depicts if slot is available for replenishment
-static String slotId = "";     //unique slot id ex: 0a5038b7-7609-4b81-b87e-3e291f386324 
-
+static long buttonHigh = 12;    //millis of last button push for switch debouncing
+static String slotStatus = "true"; //boolean which depicts if slot is available for replenishment
+static String slotId = "11111111-2222-3333-4444-555555555555";     //unique slot id ex: 0a5038b7-7609-4b81-b87e-3e291f386324
+int status = WL_IDLE_STATUS;
 
 void setup() {
   Serial.begin(115200);
 
   pinMode(dashButton, INPUT);
-  
-  while (!Serial) {
-      ; // wait for serial port to connect. Needed for native USB port only
-   }
 
-  //Start up DRS
-  DRS.begin(ssid,pass);
-  
+
+   WiFiClientSecure client;
+
+   DRS.begin(&client);
+
+  //connect to WiFi
+  Serial.println("Initializing DRS... connecting to WiFi");
+  while (status != WL_CONNECTED) {
+    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
+    status = WiFi.begin(ssid, pass);
+    Serial.println(".");
+    delay(3000);
+    status = WiFi.status();
+  }
+
+  Serial.print("Connected to ");
+  Serial.println(WiFi.SSID());
+
   //initialize slots
   DRS.retrieveSubscriptionInfo();  //check slot statuses
 

          Serial.print(slotId);
          Serial.println(" is not available at this time");
        }
        
    }

}

bool buttonPushed(void)
{
  int buttonState = digitalRead(dashButton); 
  
  if(buttonState && ((millis() - buttonHigh) > 5000))
  {
    buttonHigh = millis();
    Serial.println("Button pressed!!");
    return true;
  }
  else 
  {
    return false;
  }
}


/*******************************************************************
 Check out the included Arduino sketches and the getting started
 guide here!
 https://github.com/andium/AmazonDRS

 This is an Arduino implementation of an Amazon Dash Replenishment
 device. It currently supports the critical API endpoints necessary
 for registering a device and submitting replenishment requests. This
 library is tightly coupled to the WiFi101 library, which means it will
 work great with the Arduino MKR1000, Adafruit Feather MO w/ the ATWINC1500,
 Arduino WiFi101 shiled or anywhere the WiFi101 library is supported. Json
 parsing is provided via ArduinoJson, thanks bblanchon!
 https://github.com/bblanchon/ArduinoJson

 Written by Brian Carbonette Copyright © 2016 Andium
 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 *******************************************************************/
 #include <ESP8266WiFi.h>
 #include <WiFiClientSecure.h>
 //#include <WiFi101.h>
#include "AmazonDRS.h"

AmazonDRS DRS = AmazonDRS();
