11
11
#include < SPI.h>
12
12
#include " Adafruit_MQTT.h"
13
13
#include " Adafruit_MQTT_Client.h"
14
- #include < Adafruit_WINC1500.h>
15
-
14
+ #include < WiFi101.h>
16
15
17
16
/* ************************ WiFI Setup *****************************/
18
17
#define WINC_CS 8
19
18
#define WINC_IRQ 7
20
19
#define WINC_RST 4
21
20
#define WINC_EN 2 // or, tie EN to VCC
22
21
23
- Adafruit_WINC1500 WiFi (WINC_CS, WINC_IRQ, WINC_RST);
24
-
25
22
char ssid[] = " yournetwork" ; // your network SSID (name)
26
23
char pass[] = " yourpassword" ; // your network password (use for WPA, or use as key for WEP)
27
24
int keyIndex = 0 ; // your network key Index number (needed only for WEP)
@@ -38,7 +35,7 @@ int status = WL_IDLE_STATUS;
38
35
/* *********** Global State (you don't need to change this!) ******************/
39
36
40
37
// Set up the wifi client
41
- Adafruit_WINC1500Client client;
38
+ WiFiClient client;
42
39
43
40
Adafruit_MQTT_Client mqtt (&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_KEY);
44
41
@@ -60,10 +57,7 @@ Adafruit_MQTT_Subscribe onoffbutton = Adafruit_MQTT_Subscribe(&mqtt, AIO_USERNAM
60
57
61
58
62
59
void setup () {
63
- #ifdef WINC_EN
64
- pinMode (WINC_EN, OUTPUT);
65
- digitalWrite (WINC_EN, HIGH);
66
- #endif
60
+ WiFi.setPins (WINC_CS, WINC_IRQ, WINC_RST, WINC_EN);
67
61
68
62
while (!Serial);
69
63
Serial.begin (115200 );
@@ -154,4 +148,4 @@ void MQTT_connect() {
154
148
delay (5000 ); // wait 5 seconds
155
149
}
156
150
Serial.println (" MQTT Connected!" );
157
- }
151
+ }
0 commit comments