This repository has been archived on 2019-06-21. You can view files and clone it, but cannot push or open issues or pull requests.
PixelHub/PixelHub-Client/PixelHub-Client.ino

64 lines
1.1 KiB
Arduino
Raw Normal View History

/*
* 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[] = "ZimWeaver";
char password[] = "jungl3OfC0nfu$*on";
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();
pixelBot.Connect();
}
void loop()
{
pixelBot.Tick();
}
// ~~~ 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 ~~~ //