SKETCH:
#include <ESP8266WiFi.h>
const char* ssid = "MYSSID2";
const char* password = "abcdefABCDEF123";
void setup() {
Serial.begin(115200);
delay(100);
Serial1.begin(115200);
delay(100);
Serial1.setDebugOutput(true);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
// tried static ip, still fails...
// IPAddress ip (192,168,2,117);
// IPAddress gw(192,168,2,1);
// IPAddress msk(255,255,255,0);
// IPAddress dns0(192,168,2,1);
// IPAddress dns1(192,168,1,1);
// WiFi.config(ip, gw, msk, dns0, dns1);
if (WiFi.waitForConnectResult() != WL_CONNECTED) {
Serial1.println("Failed");
} else {
Serial.println("WiFi connected");
}
Serial.print("\n\nIP Address: ");
Serial.println(WiFi.localIP());
Serial.print("Mask: ");
Serial.println(WiFi.subnetMask());
Serial.print("Gateway: ");
Serial.println(WiFi.gatewayIP());
Serial.print("DNS0: ");
Serial.println(WiFi.dnsIP(0));
Serial.print("DNS1: ");
Serial.println(WiFi.dnsIP(1));
Serial.print("DHCP Hostname: ");
Serial.println(WiFi.hostname());
Serial.print("AutoConnect: ");
Serial.println(WiFi.getAutoConnect());
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
long rssi = WiFi.RSSI();
Serial.print("Signal Strength (RSSI):");
Serial.println(rssi);
}
void loop() {
delay(10000);
char* host = "www.adafruit.com";
Serial.print("\nConnecting to ");
Serial.println(host);
WiFiClient client;
if (!client.connect(host, 80)) {
Serial.print("Connection Failed");
return;
}
String url = "/testwifi/index.html";
Serial.print("Requesting URL: ");
Serial.println(url);
client.print(String("GET ") + url + " HTTP/1.1\r\n" +
"Host: " + host + "\r\nConnection: close\r\n\r\n");
delay(500);
while (client.available()) {
String line = client.readStringUntil('\r');
Serial.print(line);
}
}
SERIAL1 OUTPUT WHEN USING WPA2 PERSONAL (SERIAL OUTPUTS NOTHING):
sta config unchangedf r0, scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
cnt
connected with MYSSID2, channel 1
dhcp client start...
wifi evt: 0
pm open,type:2 0
SERIAL1 OUTPUT WHEN USING WPA:
sta config unchangedf r0, scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
cnt
connected with MYSSID2, channel 1
dhcp client start...
wifi evt: 0
ip:192.168.2.117,mask:255.255.255.0,gw:192.168.2.1
wifi evt: 3
pm open,type:2 0
[hostByName] request IP for: http://www.adafruit.com
[hostByName] Host: http://www.adafruit.com IP: 104.20.39.240
:ref 1
:wr
:sent 80
:ww
:rn 509
:rch 509, 5
:rcl
:abort
:c 1, 509, 514
:c0 1, 5
:ur 1
:del
SERIAL OUTPUT WHEN USING WPA:
IP Address: 192.168.2.117
Mask: 255.255.255.0
Gateway: 192.168.2.1
DNS0: 192.168.1.1
DNS1: 192.168.2.1
DHCP Hostname: ESP_88C15A
AutoConnect: 0
SSID: MYSSID2
Signal Strength (RSSI):-50
Connecting to http://www.adafruit.com
Requesting URL: /testwifi/index.html
HTTP/1.1 200 OK
Date: Wed, 03 Aug 2016 14:01:09 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: close
Set-Cookie: ...; expires=...; path=/; domain=.adafruit.com; HttpOnly
Last-Modified:...
Vary: Accept-Encoding
Server: cloudflare-nginx
4a
This is a test of the CC3000 module!
If you can read this, its working
0
HARDWARE / SOFTWARE CONFIGURATION:
Adafruit HAZZAH
Arduino IDE 1.6.10
Bench Power Supply 4.5v, 1A (HAZZAH breakout has 3.3v regulator)
USB-USARTs (cp2102's)
Router Details:
Linksys E1200 with latest firmware (but also tried a Fios-1100)
Wireless-G Only (but tried N, and mixed modes)
20MHz (but tried 20/40 auto)
Channel Auto (but tried various individual channels)
SSID Broadcast = Enabled
SSID and Passphrase (see sketch above, but tried many others, no special chars or spaces)