I am trying incorporating "cheap wifi robot" with IP webcam via smart phone

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="";

        }
      }
    }
  }
}

Just a hint. I, for one, having a short attention span, cannot make anything out of code that looks like what you've written. It helps to modularize it better. Then it's much more readable, plus it's 1000X easier to troubleshoot.

In short, you separate the "logic" of the program from the low-level details.

So, something like this ....

 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="";

        }
      }
    }
  }
}

... will end up looking like this:

        if(readString.indexOf("stop") >0)  allstop();     //checks for off
        if(readString.indexOf("left") >0)  turnleft();    //checks for left

          //clearing string for next read
          readString="";
...........
}

void allstop()
{
       analogWrite(outPin1, 0);
       digitalWrite(outPin2, LOW);
       analogWrite(outPin3, 0);
       digitalWrite(outPin4, LOW);
       Serial.print(" ");
       Serial.print("stop");       
}

Also, stuff like this is almost impossible to tell what goes with what:

        }
      }
    }
  }
}

Proper modularization will also help remove about half those closing braces.

I understand your confusion. The C language is equally confusing for me. As this is a new hobby of mine, I will learn with time. My question is more to the focus of the included web server. I have buttons that only work of a non-Android web page were you use a "mouse" click to initialize the action. I would like to include the IP WEBcam video from an android phone so I can drive the robot from the web page. I am looking for directions to figure out how to couple the two actions.
Thanks!

Sounds like you have more of a networking problem than a robotics problem. I would start over on the Networking section of the forum. Those guys probably don't find their way over here all that often. But I would also clean up my code to make it more readable, too. You'll thank yourself 3 months from now, when you try to read it.

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.

Can you post up the html source from the browser that is displaying the video? I embed video frames in pages using javascript and your app might use the same method.

I finally got back in town from work and pulled the code from the web site the IP webcam notice gives me when I fire it up and login to my dedicated router.
At second look, I am not seeing how to re-route the video feed from this code to work for me, short of using an OS that can show two web pages at the same time. Any guesses where I can go for a different app or what I can look at as far as Java to try to bring both codes into a third sketch?

<html>
<head>
<title>Android Webcam Server</title>
<link href="style.css" type="text/css" rel="stylesheet"/> 
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="jquery.jplayer.min.js"></script>
<script type="text/javascript" src="common.js"></script>
<script type="text/javascript">
$(loadJsWindowed);
</script>

</head>
<body>
<h1 class="header">Android webcam server</h1>
<p>If no video appear below, check if you have javascript enabled.

<input type="button" onclick="openRemote()" value="Open camera controls"/>

<a href="jsfs.html">Fullscreen view</a> (click video to change aspect behavior, F11 to remove browser borders).
</p>
<noscript><p>Scripts are not supported in your browser</p></noscript>
<div id="jplayer">
<input type="button" onclick="createAudio()" value="Click here to play audio with browser"/>

</div>
Click <a href="audio.wav">here</a> to play audio in external media player. Right click <a href="audio.wav">here</a> and select "save as" to record it.



<div>
<img id="img1" src="/shot.jpg?1" style="position:absolute;"/>
<img id="img2" src="/shot.jpg?2" style="position:absolute;"/>
</div>


</body>
</html>

The below html line is from the bottom html web page source code. The web page uses a javascript frame refresh that quickly loads new frames. This code is for a foscam, but I've used basically the same code for ~10 years with other webcam applications. what brand of IP webcam are you using?

newImage.src="http://cw4816.myfoscam.org/snapshot.cgi?&amp;user=xxxx&amp;pwd=xxxx"+uniq;

Foscam code

<HTML>
<HEAD>
<H1>Zoomkat's Foscam

 JavaScript Pan/Tilt Page</H1>
<TITLE>Zoomkat's Foscam JavaScript Pan/Tilt Page</TITLE>
</HEAD>
<BODY>


<table
 border="0"
 width="100%"
 cellpadding="0"
 cellspacing="0"
 summary="Webcam2000 JavaScript">
<tr>
<td
 align="left"
 bgcolor="white"
 width="40%"
 height="240">&nbsp;&nbsp;
<script LANGUAGE="JavaScript">
<!--
browserType = navigator.appName;		
newImage = new Image();
document.onstop = document_onstop;

function startstop_onclick()
{
	if (startstop.value == "Stop")
	{
		stopLoad();
	}
	else
	{
		startstop.value = "Stop";
		newImage.onload=loadNewImage;
		loadNewImage();
	}
}

function document_onstop()
{
	stopLoad();
}

function stopLoad()
{
	newImage.onload="";	
	startstop.value = "Start";
	window.status = "Live video stopped ...";
}

function loadNewImage()
{
    uniq = new Date();
    uniq = uniq.getTime();
    document.images.webcam32.src=newImage.src;
    newImage.src="http://cw4816.myfoscam.org/snapshot.cgi?&amp;user=xxxx&amp;pwd=xxxx"+uniq;
    window.status = "Displaying live video ...";    
}
function initialImage()
{
	uniq = new Date();
	uniq = uniq.getTime();
	newImage.onload=loadNewImage;
	newImage.src="http://cw4816.myfoscam.org/snapshot.cgi?&amp;user=xxxx&amp;pwd=xxxx"+uniq;
    document.images.webcam32.onload="";

}


{
	document.write('<IMG SRC="http://web.comporium.net/~shb/pix/82_0_550.jpg" name=webcam32 onload="initialImage()" width=320 height=240>');
}
//-->
</script>&nbsp;&nbsp;</td>


<tr><td align="left"> 


P/T:
<a href="http://cw4816.myfoscam.org/decoder_control.cgi?command=6&amp;onestep=2" target="inlineframe">LEFT</a>

<a href="http://cw4816.myfoscam.org/decoder_control.cgi?command=4&amp;onestep=2" target="inlineframe">RIGHT</a>

<a href="http://cw4816.myfoscam.org/decoder_control.cgi?command=0&amp;onestep=2" target="inlineframe">UP</a>
<a href="http://cw4816.myfoscam.org/decoder_control.cgi?command=2&amp;onestep=2" target="inlineframe">DOWN</a>

IR:
<a href="http://cw4816.myfoscam.org/decoder_control.cgi?command=95&amp" target="inlineframe">ON</a>
<a href="http://cw4816.myfoscam.org/decoder_control.cgi?command=94&amp" target="inlineframe">OFF</a>



<INPUT id=startstop type=button value="Stop" LANGUAGE=javascript onclick="return startstop_onclick()">



 
 </td></tr>
</table>



<IFRAME name=inlineframe style='display:none'>
</IFRAME>
</body>
</html>

I'm using IP Webcam from Pavel Khlebovich, v1.8 I think. It's been over thirty years since I had any Russian so I need an American source for my improved understanding. I appreciate your insights!

Below is a web page with the javascript source codesetup. It pulls single frames from the web cam application.

http://web.comporium.net/~shb/wc2000-PT-script.htm

I am afraid this is over my head as far as the html coding is concerned. Any good reference cheat sheets you aware of?

After a great deal of head scratching and some trial and error as well as googling, I have an updated version that incorporates the IP Webcam video feed into my controller web page. And it runs like crap on my slow XP laptops. I have not converted my "onmouse" clicks to "ontouch" touch commands to run the web server sketch off my Ematic tablet. When I figure that out, I may have a viable test platform! Here is my code. Can anyone assist me with speeding this up?
Thanks for your Help!

//modified 6/14/14 to research IP Webcam video feed incorporated into
//original driver (V4.0) sketch to now "see" where remotely driving to/
//around obstacles.
//Modified 6/8/14 to include an IP Webcam-smartphone camera video feed
//
//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 e-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 
//for use with W5100 based ethernet shields
//*********************************************************
// 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 3.0"); // after i got wifi working
}
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; 
        } 

        //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();
 // send web page
          client.println("<!DOCTYPE html>");
          client.println("<HTML>");
          client.println("<HEAD>");
          client.println("<TITLE>Arduino L298N shield + video feed test page</TITLE>");
          
          client.println("</HEAD><BODY>");
          client.println("
");
          client.println("<iframe src=""http://192.168.1.3:8080"" name=""vid"" height=""340"" width=""440""> </iframe>");
          client.println("<H1>NitaBot's Controller V5.0 with video feed</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("<img name=""FoscamCamera"" src"" http://192.168.1.3:8080/videostream.cgi?"" width=""480"" height=""360""/>");
          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="";

        }
      }
    }
  }
}

I didn't mention that I have a Sprint LG smart phone running IP Webcam. I have my Arduino Uno R3 with a Seed Studio ethernet shield R3 and a modified Seeed Studio motor shield v1.1 (actually I stripped the parts off it and rebuilt it to correct the conflict with the ethernet shield). I have a dedicated router (wrn1003) that I connect everything to/off to view on my wireless Gateway laptop what's going on. Hey, I like to "collect" (i.e. pack-ratting) electronics goodies. I am into "off the shelf" engineering and designing.
Learning more about the Open Source software communities is where I am filling a void in my interests.
Later!

I have done more research and have found WifiBot controller for Android. I can use my old cell phone and the IPWebcam app to give me a cheap wifi camera. I am working on modifying my sketch to accept the code generated (data string?) from WifiBot controller (non-BT!!!) to control my Arduino Uno R3, SeedStudio ethernet shield hard cabled to my wireless router. The Seeed Studio ethernet shield does not have the MAC address hard coded into it. Once I fixed that, I was able to control the sketch from a laptop with wifi and it works well.