Go Down

Topic: wifly outside lan (Read 1 time) previous topic - next topic


Hi everyone have a big problem to solve,
so i have server(spare laptop runing ubuntu server 10.04) running on my local lan which ip is no-ip address is lmasss.hopto.org) where i uploaded  tank.html but if i accsess my page using lmasss.hopo.org and try to move forward in responce from tank window i get error that my page all code similar to ethernet shield) is not accsesable.question is somhow to do so it still will send data from lmasss.hopo.org to so i can control tank from outside of my lan?
Html page
Code: [Select]
<title>Arduino wi-fi tank</title>

html,body{font:normal 14px arial,helvetica;}
#content { width:600px;margin:100px auto;}
#response { font-family:Courier;}
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>

<div id="content">
<tr><td>&nbsp;</td><td><button rel="n">Fwd</button></td><td>&nbsp;</td></tr>
<tr><td><button rel="w">Left</button></td><td>&nbsp;</td><td><button rel="e">Right</button></td></tr>
<tr><td>&nbsp;</td><td><button rel="s">Back</button></td><td>&nbsp;</td></tr>

<div style="margin-top:20px;border-top:1px solid #ccc;padding-top:10px;">
<h3>Response from tank</h3>
<div id="response">
<iframe id="tank"></iframe>


$("button").click(function() {
//$("#response").load("" + $(this).attr("rel"));
$("#tank").attr("src", "" + $(this).attr("rel"));


arduino code
Code: [Select]
* Web Server
* (Based on Ethernet's WebServer Example)
* A simple web server that shows the value of the analog input pins.

#include "WiFly.h"
#include "Credentials.h"
#include <WString.h>

String readString = String(100);

long startTime;

Server server(80);

// set the output pins
int baseMotorEnablePin = 5;
int baseMotorPin1 = 6;                             
int baseMotorPin2 = 7;                           
int shoulderMotorEnablePin = 14;
int shoulderMotorPin1 = 15;                             
int shoulderMotorPin2 = 16;   

void setup() {

  if (!WiFly.join(ssid, passphrase, WEP_MODE)) {
    while (1) {
      // Hang on failure.
    //set the SN754410 pins as outputs:
  pinMode(baseMotorPin1, OUTPUT);
  pinMode(baseMotorPin2, OUTPUT);
  pinMode(baseMotorEnablePin, OUTPUT);
  digitalWrite(baseMotorEnablePin, HIGH);
  pinMode(shoulderMotorPin1, OUTPUT);
  pinMode(shoulderMotorPin2, OUTPUT);
  pinMode(shoulderMotorEnablePin, OUTPUT);
  digitalWrite(shoulderMotorEnablePin, HIGH);


  Serial.print("IP: ");

void loop() {
if(startTime!=0 && millis()-startTime>1500){

Client client = server.available();
if (client) {
   // an http request ends with a blank line
   boolean current_line_is_blank = true;
   String cmd = ""; 
   int i = 0;
   while (client.connected()) {
     if (client.available()) {
       char c = client.read();
       cmd += c;
       if (cmd == "GET /?dir=n")
        client.println("moving forward");
        if (c == '\n') {
          // we're starting a new line
          current_line_is_blank = true;
        else if (c != '\r') {
          // we've gotten a character on the current line
          current_line_is_blank = false;


void moveForward(){
  digitalWrite(baseMotorPin1, LOW);   
  digitalWrite(baseMotorPin2, HIGH); 
  digitalWrite(shoulderMotorPin1, LOW);   
  digitalWrite(shoulderMotorPin2, HIGH);

void moveStop(){
  digitalWrite(baseMotorPin1, LOW);   
  digitalWrite(baseMotorPin2, LOW);
  digitalWrite(shoulderMotorPin1, LOW);   
  digitalWrite(shoulderMotorPin2, LOW);



If you are using a router, you will need to port foward incomming traffic to your arduino server.  You will need to run your arduino on a different port than your pc server, such as port 81. In your html page you would have something like below.

Google forum search: Use Google Search box in upper right side of this page.
Why I like my 2005 Rio Yellow Honda S2000  https://www.youtube.com/watch?v=pWjMvrkUqX0


Mar 05, 2011, 01:28 am Last Edit: Mar 05, 2011, 02:08 am by LMas Reason: 1
thanx zoom for you fast replay so say i use port 8888 for arduino and do port forward , thats easy but what to do with html i totaly new to this :(

just changed port to 8888 and in html file http://lmasss.hopto.org:888?dir= tryed o connect now says cant connect lmasss.hopto.org:8888

restarted router and it worked

Thank you.

Go Up