I finally found out the trick to getting zoomkat's code to work on my router: I had to reassign a MAC address other than the examples of de:ad:be:ef:fe:ed. Once I put more numbers in place of letters, I can now control my dc motors with my reworked Seeed studio motor shield. I couldn't control their ethernet shield (V1.1 which is Not on their wiki page, the all white underside, sold at my Radio shack) along with the motor shield simultaneously. So I redid the motor shield pins and it worked fine. I could even, with the dead beef feed MAC address hook a wired laptop to the router and control the motor controller via the Web page.
My next trick is to modify the control web page to include the video feed from an unused smart phone camera and the IPwebcam app. I can look up the http://192.168.1.6:8080 and select the java script option and i can "see" the video from the smart phone camera. I now want to see if I can combine the two web pages to watch where I am steering my platform to and around. The controller code has a web page of 192.168.1.177:84. Where do I look to figure out how to combine both ports/activities into the same or different web page?
I thank you for your time!
//version 4.0 5/14/14 after discovery of the usage of pins D3 & D4...
//Modified 4/25/14 for my DIY motorshield to work in
//conjunction with SEEDSTUDIO ethernet shield.
//for use with IDE 1.0
//open serial monitor to see what the arduino receives
//use the \ slash to escape the " in the html
//address will look like http://192.168.1.177:84 when submitted
//for use with W5100 based ethernet shields
//Powering a servo from the arduino usually DOES NOT WORK.
//note that the below bug fix may be required
// http://code.google.com/p/arduino/issues/detail?id=605
//*********************************************************
//
// DECLARATIONS
////////////////////////////////////////////////////////////
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0x00, 0xA8, 0xBE, 0xE0, 0x89, 0x01 }; //physical mac address
byte ip[] = { 192, 168, 1, 177 }; // ip in lan
byte gateway[] = { 192, 168, 1, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
// setting up pins for my L298N motorshield
int outPin1 = 5; // 2;
int outPin2 = 6; // 3;
int outPin3 = 7; // 6;
int outPin4 = 8; // 7;
EthernetServer server(84); //server port
String readString;
//////////////////////
void setup(){
// starting 4 pins for motorshield
pinMode(outPin1, OUTPUT);
pinMode(outPin2, OUTPUT);
pinMode(outPin3, OUTPUT);
pinMode(outPin4, OUTPUT);
//start Ethernet
Ethernet.begin(mac, ip, gateway, subnet);
server.begin();
//enable serial data print
Serial.begin(9600);
Serial.println("sever motorshield test 1.0"); // so I can keep track of what is loaded
}
void loop()
{
// Create a client connection
EthernetClient client = server.available(); //try to get client
if (client) { // got client?
while (client.connected()) { //
if (client.available()) {
char c = client.read();
//read char by char HTTP request
if (readString.length() < 100) {
//store characters to string
readString += c;
//Serial.print(c);
}
//if HTTP request has ended
if (c == '\n') { //&& currentLineIsBlank){
///////////////
Serial.println(readString); //print to serial monitor for debuging
client.println("HTTP/1.1 200 OK"); //send new page
client.println("Content-Type: text/html");
//client.println("Connection: close");
client.println();
// send web page
client.println("<!DOCTYPE html>");
client.println("<HTML>");
client.println("<HEAD>");
client.println("<TITLE>Arduino DIY motorshield test page</TITLE>");
client.println("</HEAD>");
client.println("<BODY>");
client.println("<H1>NitaBot's Controller V4.0</H1>");
// mousedown buttons
client.println("
<input type=\"button\" value=\"FWD\" onclick=\"location.href ('/?fwd');\"/>");
client.println("<input type=\"button\" value=\"LEFT\" onclick=\"location.href ('/?left');\"/>");
client.println("<input type=\"button\" value=\"STOP\" onclick=\"location.href ('/?stop');\"/>");
client.println("<input type=\"button\" value=\"RIGHT\" onclick=\"location.href ('/?right');\"/>");
client.println("<input type=\"button\" value=\"REV\" onclick=\"location.href ('/?rev');\"/>");
client.println("</BODY>");
client.println("</HTML>");
delay(1);
//stopping client
client.stop();
///////////////////// control arduino pin
if(readString.indexOf("fwd") >0)//checks for on
{
analogWrite(outPin1, 150);
digitalWrite(outPin2, LOW);
analogWrite(outPin3, 150);
digitalWrite(outPin4, LOW);
Serial.print(" ");
Serial.print("forward");
}
if(readString.indexOf("left") >0)//checks for left
{
analogWrite(outPin1, 150);
digitalWrite(outPin2, LOW);
digitalWrite(outPin3, LOW);
analogWrite(outPin4, 150);
Serial.print(" ");
Serial.print("left");
}
if(readString.indexOf("right") >0)//checks for right
{
digitalWrite(outPin1, LOW);
analogWrite(outPin2, 150);
analogWrite(outPin3, 150);
digitalWrite(outPin4, LOW);
Serial.print(" ");
Serial.print("right");
}
if(readString.indexOf("rev") >0)//checks for rev
{
digitalWrite(outPin1, LOW);
analogWrite(outPin2, 150);
digitalWrite(outPin3, LOW);
analogWrite(outPin4, 150);
Serial.print(" ");
Serial.print("rev");
}
if(readString.indexOf("stop") >0)//checks for off
{
analogWrite(outPin1, 0);
digitalWrite(outPin2, LOW);
analogWrite(outPin3, 0);
digitalWrite(outPin4, LOW);
Serial.print(" ");
Serial.print("stop");
}
//clearing string for next read
readString="";
}
}
}
}
}