Skip to content

Instantly share code, notes, and snippets.

@Mr-Coxall
Created February 27, 2018 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mr-Coxall/c88678f3b53e673be3e17d57b48afc2a to your computer and use it in GitHub Desktop.
Save Mr-Coxall/c88678f3b53e673be3e17d57b48afc2a to your computer and use it in GitHub Desktop.
Wifi connection sketch
/*
* Created by: Mr. Coxall
* Created on: Feb 2018
*
** Connect the ESP8266 unit to an existing WiFi access point
** For more information see http://42bots.com
*
* Updated by Mr. Coxall to connect to school network
*/
#include <ESP8266WiFi.h>
// Replace these with your WiFi network settings
const char* ssid = "OCSB"; //replace this with your WiFi network name
const char* password = "wireless4all"; //replace this with your WiFi network password
void setup()
{
WiFi.disconnect(true);
delay(100);
Serial.begin(9600);
WiFi.begin(ssid, password);
Serial.println();
Serial.println("Connecting");
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
//Serial.println(WiFi.status());
Serial.println(WiFi.localIP());
}
Serial.println("success!");
Serial.print("IP Address is: ");
Serial.println(WiFi.localIP());
WiFi.disconnect(true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment