update to wifi101 library

This commit is contained in:
ladyada 2018-01-29 14:27:41 -05:00
parent 5b25a96d1b
commit f0e97737f7

View File

@ -11,8 +11,7 @@
#include <SPI.h> #include <SPI.h>
#include "Adafruit_MQTT.h" #include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h" #include "Adafruit_MQTT_Client.h"
#include <Adafruit_WINC1500.h> #include <WiFi101.h>
/************************* WiFI Setup *****************************/ /************************* WiFI Setup *****************************/
#define WINC_CS 8 #define WINC_CS 8
@ -20,8 +19,6 @@
#define WINC_RST 4 #define WINC_RST 4
#define WINC_EN 2 // or, tie EN to VCC #define WINC_EN 2 // or, tie EN to VCC
Adafruit_WINC1500 WiFi(WINC_CS, WINC_IRQ, WINC_RST);
char ssid[] = "yournetwork"; // your network SSID (name) char ssid[] = "yournetwork"; // your network SSID (name)
char pass[] = "yourpassword"; // your network password (use for WPA, or use as key for WEP) char pass[] = "yourpassword"; // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0; // your network key Index number (needed only for WEP) int keyIndex = 0; // your network key Index number (needed only for WEP)
@ -38,7 +35,7 @@ int status = WL_IDLE_STATUS;
/************ Global State (you don't need to change this!) ******************/ /************ Global State (you don't need to change this!) ******************/
//Set up the wifi client //Set up the wifi client
Adafruit_WINC1500Client client; WiFiClient client;
Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_KEY); Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_KEY);
@ -60,10 +57,7 @@ Adafruit_MQTT_Subscribe onoffbutton = Adafruit_MQTT_Subscribe(&mqtt, AIO_USERNAM
void setup() { void setup() {
#ifdef WINC_EN WiFi.setPins(WINC_CS, WINC_IRQ, WINC_RST, WINC_EN);
pinMode(WINC_EN, OUTPUT);
digitalWrite(WINC_EN, HIGH);
#endif
while (!Serial); while (!Serial);
Serial.begin(115200); Serial.begin(115200);
@ -154,4 +148,4 @@ void MQTT_connect() {
delay(5000); // wait 5 seconds delay(5000); // wait 5 seconds
} }
Serial.println("MQTT Connected!"); Serial.println("MQTT Connected!");
} }