2016-10-16 09:16:54 +00:00
|
|
|
/*
|
|
|
|
* Connecting to a WiFi network with WPA
|
|
|
|
************************************************
|
|
|
|
* Originally adapted from https://www.arduino.cc/en/Tutorial/ConnectWithWPA
|
|
|
|
* by Starbeamrainbowlabs
|
|
|
|
*/
|
|
|
|
#include <ESP8266WiFi.h>
|
|
|
|
|
2016-10-21 20:47:49 +00:00
|
|
|
#include "PixelBot.h"
|
2016-10-16 14:08:43 +00:00
|
|
|
|
2016-10-21 20:51:53 +00:00
|
|
|
char ssid[] = "ssid";
|
|
|
|
char password[] = "password";
|
2016-10-16 09:16:54 +00:00
|
|
|
|
2016-10-21 20:47:49 +00:00
|
|
|
PixelBot pixelBot;
|
2016-10-21 20:16:15 +00:00
|
|
|
|
2016-10-16 09:16:54 +00:00
|
|
|
void setup()
|
|
|
|
{
|
2016-10-21 20:16:15 +00:00
|
|
|
// Setup the serial connection
|
|
|
|
Serial.begin(4800);
|
|
|
|
|
|
|
|
Serial.println("Hello, world!");
|
|
|
|
|
|
|
|
Serial.println("Beginning connection sequence.");
|
|
|
|
Serial.print("Attempting to connect to ");
|
|
|
|
Serial.print(ssid);
|
|
|
|
Serial.print(" - ");
|
|
|
|
|
|
|
|
WiFi.begin(ssid, password);
|
|
|
|
|
|
|
|
while(WiFi.status() != WL_CONNECTED)
|
|
|
|
{
|
|
|
|
// Wait a second for the connection to be established
|
|
|
|
delay(1000);
|
|
|
|
}
|
|
|
|
|
|
|
|
Serial.println("success!");
|
|
|
|
|
|
|
|
printWiFiInfoLocal();
|
2016-10-21 20:47:49 +00:00
|
|
|
pixelBot.FindServer();
|
2016-10-16 09:16:54 +00:00
|
|
|
}
|
|
|
|
|
2016-10-21 20:16:15 +00:00
|
|
|
|
2016-10-16 09:16:54 +00:00
|
|
|
void loop()
|
|
|
|
{
|
2016-10-21 20:16:15 +00:00
|
|
|
|
2016-10-16 09:16:54 +00:00
|
|
|
}
|
|
|
|
|
2016-10-21 20:16:15 +00:00
|
|
|
|
|
|
|
// ~~~ WiFi Diagnostics ~~~ //
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Prints the local IP address to the serial connection.
|
|
|
|
/// </summary>
|
2016-10-16 09:16:54 +00:00
|
|
|
void printWiFiInfoLocal()
|
|
|
|
{
|
2016-10-21 20:16:15 +00:00
|
|
|
Serial.print("IP Address: ");
|
|
|
|
Serial.println(WiFi.localIP());
|
2016-10-16 09:16:54 +00:00
|
|
|
}
|
|
|
|
|
2016-10-21 20:16:15 +00:00
|
|
|
// ~~~ PixelHub auto discovery system ~~~ //
|
|
|
|
|
|
|
|
|