21
21
22
22
23
23
#include < SPI.h>
24
- #include < WiFi101 .h>
24
+ #include < Adafruit_WINC1500 .h>
25
25
26
- char ssid[] = " yourNetwork" ; // your network SSID (name)
27
- char pass[] = " secretPassword" ; // your network password (use for WPA, or use as key for WEP)
28
- int keyIndex = 0 ; // your network key Index number (needed only for WEP)
26
+ #define WINC_CS 8
27
+ #define WINC_IRQ 7
28
+ #define WINC_RST 4
29
+
30
+ Adafruit_WINC1500 WiFi (WINC_CS, WINC_IRQ, WINC_RST);
31
+
32
+ // Default Hardware SPI (SCK/MOSI/MISO), SS -> #10, INT -> #7, RST -> #5, EN -> 3-5V
33
+ // Adafruit_WINC1500 WiFi;
34
+
35
+
36
+ char ssid[] = " yournetwork" ; // your network SSID (name)
37
+ char pass[] = " yourpassword" ; // your network password (use for WPA, or use as key for WEP)
38
+ int keyIndex = 0 ; // your network key Index number (needed only for WEP)
29
39
30
40
int status = WL_IDLE_STATUS;
31
41
// if you don't want to use DNS (and reduce your sketch size)
32
42
// use the numeric IP instead of the name for the server:
33
- // IPAddress server(74,125,232,128); // numeric IP for Google (no DNS)
34
- char server[] = " www.google.com" ; // name address for Google (using DNS)
43
+ // IPAddress server(141,101,112,175); // numeric IP for Google (no DNS)
44
+ char server[] = " www.adafruit.com" ; // name address for Google (using DNS)
45
+ #define webpage " /testwifi/index.html"
46
+
35
47
36
48
// Initialize the Ethernet client library
37
49
// with the IP address and port of the server
38
50
// that you want to connect to (port 80 is default for HTTP):
39
- WiFiClient client;
51
+ Adafruit_WINC1500Client client;
40
52
41
53
void setup () {
42
- // Initialize serial and wait for port to open:
43
- Serial.begin (9600 );
44
54
while (!Serial) {
45
55
; // wait for serial port to connect. Needed for native USB port only
46
56
}
47
57
58
+ // Initialize serial and wait for port to open:
59
+ Serial.begin (9600 );
60
+
61
+ Serial.println (" WINC1500 Web client test" );
62
+
48
63
// check for the presence of the shield:
49
64
if (WiFi.status () == WL_NO_SHIELD) {
50
65
Serial.println (" WiFi shield not present" );
@@ -70,8 +85,10 @@ void setup() {
70
85
if (client.connect (server, 80 )) {
71
86
Serial.println (" connected to server" );
72
87
// Make a HTTP request:
73
- client.println (" GET /search?q=arduino HTTP/1.1" );
74
- client.println (" Host: www.google.com" );
88
+ client.print (" GET " );
89
+ client.print (webpage);
90
+ client.println (" HTTP/1.1" );
91
+ client.print (" Host: " ); client.println (server);
75
92
client.println (" Connection: close" );
76
93
client.println ();
77
94
}
@@ -114,7 +131,3 @@ void printWifiStatus() {
114
131
Serial.println (" dBm" );
115
132
}
116
133
117
-
118
-
119
-
120
-
0 commit comments