Connecting ESP8266 to my wifi network
Posted: Sun Apr 24, 2016 5:37 pm
Hi guys,
I'm very familiar with low level microcomputer control and protocol but very unfamiliar with http and internet protocol, so please bear with me.
My professor has tasked me with getting a whole bunch of adafruit huzzah esp8266 boards connected to the internet, and talking with a sever. I have been furiously reading up on HTTP, how the protocol works, POST/GET, etc. With limited success.
So now I'm trying to get this esp8266 connected to my lab's wifi. I wrote a simple code that just tries to connect. I put in the internet name and password correctly but never get into the "connected" loop. The problem is I don't really know how to go about debugging. I haven't been able to find a readme or some documentation of the ESP8266Wifi library, and I struggle to figure it out by reading through the library code. For instance, what exactly is status, and where can I find what it is returning?
Feeling stuck - any advice/suggestions appreciated!
I'm very familiar with low level microcomputer control and protocol but very unfamiliar with http and internet protocol, so please bear with me.
My professor has tasked me with getting a whole bunch of adafruit huzzah esp8266 boards connected to the internet, and talking with a sever. I have been furiously reading up on HTTP, how the protocol works, POST/GET, etc. With limited success.
So now I'm trying to get this esp8266 connected to my lab's wifi. I wrote a simple code that just tries to connect. I put in the internet name and password correctly but never get into the "connected" loop. The problem is I don't really know how to go about debugging. I haven't been able to find a readme or some documentation of the ESP8266Wifi library, and I struggle to figure it out by reading through the library code. For instance, what exactly is status, and where can I find what it is returning?
Feeling stuck - any advice/suggestions appreciated!
Code: Select all
#include <ESP8266WiFi.h>
#include <ESP8266WiFiAP.h>
#include <ESP8266WiFiGeneric.h>
#include <ESP8266WiFiMulti.h>
#include <ESP8266WiFiScan.h>
#include <ESP8266WiFiSTA.h>
#include <ESP8266WiFiType.h>
#include <WiFiClient.h>
#include <WiFiClientSecure.h>
#include <WiFiServer.h>
#include <WiFiUdp.h>
char ssid[] = "LOFT"; // the name of your network
char pass[] = "pass";
int status = WL_IDLE_STATUS; // the Wifi radio's status
byte mac[6]; // the MAC address of your Wifi shield
void setup()
{
Serial.begin(9600);
Serial.println("serial begin");
delay(1000);
status = WiFi.begin(ssid, pass);
delay(1000);
Serial.println("past wifi begin");
if ( status != WL_CONNECTED) {
Serial.println("Couldn't get a wifi connection");
//while(true);
}
else{
Serial.println("Successfully connected");
}
}
void loop () {
Serial.println(getMacAddress());
delay(1000);
}