Hardware Reference
In-Depth Information
pinMode(RED, OUTPUT);
pinMode(GREEN, OUTPUT);
pinMode(BLUE, OUTPUT);
//Connect with DHCP
if (!Ethernet.begin(mac))
{
Serial.println("Could not Configure Ethernet with DHCP.");
return;
}
else
{
Serial.println("Ethernet Configured!");
}
//Start the server
server.begin();
Serial.print("Server Started.\nLocal IP: ");
Serial.println(Ethernet.localIP());
}
void loop()
{
EthernetClient client = server.available();
if (client)
{
//An HTTP request ends with a blank line
boolean currentLineIsBlank = true;
boolean sentHeader = false;
while (client.connected())
{
if (client.available())
{
char c = client.read(); //Read from the incoming buffer
if(receiving && c == ' ') receiving = false; //Done receiving
if(c == '?') receiving = true; //Found arguments
//This looks at the GET requests
if(receiving)
{
//An LED command is specified with an L
if (c == 'L')
{
Serial.print("Toggling Pin ");
pin = client.parseInt();
Serial.println(pin);
Search WWH ::




Custom Search