Toll-Free Customer Support 24/7

Ethernet Web Shield- Smart Internet Application Development Kit

/*
* Project name:
Ethernet Web Shield- Smart Internet Application Development Kit
* Copyright
(c) Researchdesignlab.com
* Description:

* Test configuration:
MCU: ATMEGA328
Dev.Board: Arduino uno
Oscillator: 16 MHz
Software: Arduino

*/

// A simple web server that always just says "Hello World"

#include "etherShield.h"
#include "ETHER_28J60.h"

int outputPin1 = 2;
int outputPin2 = 3;
int outputPin3 = 4;
int outputPin4 = 5;

static uint8_t mac[6] = {0x54, 0x55, 0x58, 0x10, 0x00, 0x24}; // this just needs to be unique for your network,
// so unless you have more than one of these boards
// connected, you should be fine with this value.

static uint8_t ip[4] = {192, 168, 1, 15}; // the IP address for your board. Check your home hub
// to find an IP address not in use and pick that
// this or 10.0.0.15 are likely formats for an address
// that will work.

static uint16_t port = 80; // Use port 80 - the standard for HTTP

ETHER_28J60 e;
char flag1=0,flag2=0,flag3=0,flag4=0;
void setup()
{
e.setup(mac, ip, port);
pinMode(outputPin1, OUTPUT);
pinMode(outputPin2, OUTPUT);
pinMode(outputPin3, OUTPUT);
pinMode(outputPin4, OUTPUT);

}

void loop()
{
char* params;
if (params = e.serviceRequest())
{
e.print("<H1>Web Remote</H1>");
e.print("<A HREF='?cmd1=off'>RDL</A></BR>");
// dispaly();
if (strcmp(params, "?cmd1=on") == 0)
{
digitalWrite(outputPin1, HIGH);
flag1=1;
dispaly();
}
else if (strcmp(params, "?cmd1=off") == 0) // Modified -- 2011 12 15 # Ben Schueler
{
digitalWrite(outputPin1, LOW);
flag1=0;
dispaly();
}
if (strcmp(params, "?cmd2=on") == 0)
{
digitalWrite(outputPin2, HIGH);
flag2=1;
dispaly();

}
else if (strcmp(params, "?cmd2=off") == 0) // Modified -- 2011 12 15 # Ben Schueler
{
digitalWrite(outputPin2, LOW);
flag2=0;
dispaly();
}
if (strcmp(params, "?cmd3=on") == 0)
{
digitalWrite(outputPin3, HIGH);
flag3=1;
dispaly();

}
else if (strcmp(params, "?cmd3=off") == 0) // Modified -- 2011 12 15 # Ben Schueler
{
digitalWrite(outputPin3, LOW);
flag3=0;
dispaly();
}
if (strcmp(params, "?cmd4=on") == 0)
{
digitalWrite(outputPin4, HIGH);
flag4=1;
dispaly();

}
else if (strcmp(params, "?cmd4=off") == 0) // Modified -- 2011 12 15 # Ben Schueler
{
digitalWrite(outputPin4, LOW);
flag4=0;
dispaly();
}
e.respond();
}
}
void dispaly()
{

if(flag1==0)
e.print("<A HREF='?cmd1=on'>RELAY1 ON</A></BR>");
else
e.print("<A HREF='?cmd1=off'>RELAY1 OFF</A></BR>");

if(flag2==0)
e.print("<A HREF='?cmd2=on'>'>RELAY2 ON</A></BR>");
else
e.print("<A HREF='?cmd2=off'>RELAY2 OFF</A></BR>");


if(flag3==0)
e.print("<A HREF='?cmd3=on'>'>RELAY3 ON</A></BR>");
else
e.print("<A HREF='?cmd3=off'>RELAY3 OFF</A></BR>");

if(flag4==0)
e.print("<A HREF='?cmd4=on'>'>RELAY4 ON</A></BR>");
else
e.print("<A HREF='?cmd4=off'>RELAY4 OFF</A></BR>");

}

Back to top