void InitializeGarageDoorWebserver() { static uint8_t auLocalMAC[] = LOCAL_MAC_ADDRESS; static uint8_t auLocalIPAddress[] = LOCAL_IP_ADDRESS; AccessControlServer.setDefaultCommand(ShowWebRoot); AccessControlServer.addCommand("LetMeIn.html", CheckLogin); AccessControlServer.addCommand("index.html", ShowWebRoot); AccessControlServer.setFailureCommand(ShowPageNotFound); Ethernet.begin(auLocalMAC, auLocalIPAddress); AccessControlServer.begin(); }
void setup() { #if DEBUG Serial.begin(9600); Serial.println("Hello world."); #endif /* setup our default command that will be run when the user accesses * the root page on the server */ webserver.setDefaultCommand(&helloCmd); /* run the same command if you try to load /index.html, a common * default page name */ webserver.addCommand("index.html", &helloCmd); /* start the webserver */ webserver.begin(); }
/* ================================================================== * * Function: init * Description: Initialize the server * Parameters: none * ================================================================== */ void Server::init() { /* Default command accessed through http://ip_address */ webserver.setDefaultCommand(&web_index); /* Command to handle web inputs, accessed through http://ip_address/web_input */ webserver.addCommand("web_input", &web_input, this); /* start the webserver */ webserver.begin(); // Print the IP so we know where to connect Particle.variable("ipAddress", myIpAddress, STRING); IPAddress myIp = WiFi.localIP(); sprintf(myIpAddress, "%d.%d.%d.%d", myIp[0], myIp[1], myIp[2], myIp[3]); power_status = SERVER_POWER_ON; }