#include <Arduino.h>
#include <algorithm>
struct device {
char *type;
char *location;
bool active;
String IPAddress;
String WEBaddress;
};
device d1;
device d2;
struct KEYWORDS
{
char *cmd1[5] = {"set","get","reset","clearbuffer","resetesp"};
char *cmd2[4] = {"function","wifi","led","ble"};
char *opt[8] = {"on","off","up","down","bright","delay","fillall","effect"};
char *hsv[4] = {"hsv","hue","sat","val"};
char *rgb[4] = {"rgb","red","green","blue"};
char *wifi[7] = {"sta","ap","ssid","password","ip","dns","gateway"};
}k;
/*
struct FIRST
{
String set = "set";
String _get = "get";
String reset = "reset";
String clearbuffer = "clearbuffer";
String resetesp = "resetesp";
} first;
struct SECOND
{
String function = "function";
String wifi = "wifi";
String led = "led";
String ble = "ble";
} second;
struct THIRD
{
String on ="on";
String off = "off";
String up = "up";
String down = "down";
String bright = "bright";
String _delay = "delay";
String fillall = "fillall";
String effect = "effect";
} third;
struct HSV
{
String hsv = "hsv";
String hue = "hue";
String sat = "sat";
String val = "val";
} hsv;
struct RGB
{
String rgb = "rgb";
String red = "red";
String green = "green";
String blue = "blue";
} rgb;
struct WIFI
{
String sta = "sta";
String ap = "ap";
String ssid = "ssid";
String password = "password";
String ip = "ip";
String dns = "dns";
String gateway = "gateway";
} wifi;
*/
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
d1.type = "router";
d1.location = "livingroom";
d1.active = true;
d1.IPAddress = "192.168.50.1";
d1.WEBaddress = "http://192.168.50.1/Main_Login.asp";
d2.type = "router";
d2.location = "masterbedroom";
d2.active = true;
d2.IPAddress = "192.168.50.2";
d2.WEBaddress = "n/a";
//printf("first[1] = %s\n", FIRST[0]);
printf("first[0] = %s\n", k.cmd1[0]);
//printf("first[0] = %s\n", k.[0][0]);
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
//Serial.println("Device 1 " + d1.type +"Location :" + d1.location);
//Serial.println(d1.type);
delay(2000);
int startpos = random(0, 20);
int length = random(3, 12);
int stoppos = startpos + length;
stoppos > startpos ? Serial.println("Yes") : Serial.println("No");
int maxpixel = max(stoppos, length);
maxpixel = max(startpos, maxpixel);
Serial.println("The max pixel is: " + String(maxpixel));
int minpixel = min(startpos, stoppos);
minpixel = min(minpixel,length);
Serial.println("The minimum pixel is: "+ String(minpixel));
}