62 lines
1.1 KiB
C++
62 lines
1.1 KiB
C++
/*
|
|
* Connecting to a WiFi network with WPA
|
|
************************************************
|
|
* Originally adapted from https://www.arduino.cc/en/Tutorial/ConnectWithWPA
|
|
* by Starbeamrainbowlabs
|
|
*/
|
|
#include <ESP8266WiFi.h>
|
|
|
|
#include "PixelBot.h"
|
|
|
|
char ssid[] = "ssid";
|
|
char password[] = "password";
|
|
|
|
PixelBot pixelBot;
|
|
|
|
void setup()
|
|
{
|
|
// 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();
|
|
pixelBot.FindServer();
|
|
}
|
|
|
|
|
|
void loop()
|
|
{
|
|
|
|
}
|
|
|
|
|
|
// ~~~ WiFi Diagnostics ~~~ //
|
|
|
|
/// <summary>
|
|
/// Prints the local IP address to the serial connection.
|
|
/// </summary>
|
|
void printWiFiInfoLocal()
|
|
{
|
|
Serial.print("IP Address: ");
|
|
Serial.println(WiFi.localIP());
|
|
}
|
|
|
|
// ~~~ PixelHub auto discovery system ~~~ //
|
|
|
|
|