84 lines
1.9 KiB
C++
84 lines
1.9 KiB
C++
//========================================================
|
|
// Header Include
|
|
//========================================================
|
|
|
|
// Header File
|
|
#include <WiFi.h>
|
|
#include "header.h"
|
|
|
|
//========================================================
|
|
// SETUP
|
|
//========================================================
|
|
|
|
void setup() {
|
|
|
|
// Serial Port
|
|
Serial.begin(115200);
|
|
Serial.println();
|
|
|
|
// Display
|
|
displayInit(); // Starting The Display
|
|
displayIdentity(); // Display Identity
|
|
|
|
// WiFi
|
|
setupWiFiAndConfig("TAKEONE");
|
|
// displayStatus("TCP Connect", server, port);
|
|
|
|
// Buttons Start
|
|
BlueBody.begin(); // Connect your button between pin 2 and GND
|
|
BlueHead.begin(); // Connect your button between pin 3 and GND
|
|
RedBody.begin(); // Connect your button between pin 4 and GND
|
|
RedHead.begin(); // Connect your button between pin 4 and GND
|
|
YellowButton.begin(); // Connect your button between pin 4 and GND
|
|
|
|
// Stop
|
|
Serial.println();
|
|
|
|
}
|
|
|
|
//========================================================
|
|
// LOOP
|
|
//========================================================
|
|
|
|
void loop() {
|
|
|
|
// Monitor
|
|
// monitorConnection();
|
|
|
|
// Buttons
|
|
read_buttons();
|
|
|
|
}
|
|
|
|
//========================================================
|
|
// Read Button
|
|
//========================================================
|
|
|
|
void read_buttons() {
|
|
|
|
if(BlueBody.pressed()) {
|
|
Serial.println("Blue Body");
|
|
}
|
|
|
|
if(BlueHead.pressed()) {
|
|
Serial.println("Blue Head");
|
|
}
|
|
|
|
if(RedBody.pressed()) {
|
|
Serial.println("Red Body");
|
|
}
|
|
|
|
if(RedHead.pressed()) {
|
|
Serial.println("Red Head");
|
|
}
|
|
|
|
if(YellowButton.pressed()) {
|
|
Serial.println("Yellow");
|
|
resetWiFiAndConfig();
|
|
}
|
|
|
|
}
|
|
|
|
//========================================================
|
|
// OLED Display
|
|
//========================================================
|