Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7612855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:01:16+00:00 2026-05-31T02:01:16+00:00

I’m pretty much a novice in arduino code and I’m having trouble with the

  • 0

I’m pretty much a novice in arduino code and I’m having trouble with the following code. When I compile it with arduino 0022 there are no errors. If I access the Ethernet shield I see the HTML page fine. The troubles come with that the link to the video I want to post in the code. I’m able to see the frame but the link doesn’t ever come up. within that frame all I see is the HTML page that has been created. Is there a chance that there’s an error in the code or HTML formatting? Is there a specific Library I need to use? thanks in advance for the help!

#include <SPI.h>
#include <Client.h>
#include <Ethernet.h>
#include <Server.h>
#include <Udp.h>
#include <Servo.h>
char Link[]= "http://www.anywebsite.com"; //video link
Servo tilt;
Servo pan;
int panpos = 90;
int tiltpos = 90;
byte mac[] = { 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF }; //physical mac address
byte ip[] = { 192, 128, 13, 169 };           // ip in lan
byte gateway[] = {  192, 128, 13,1 };            // internet access via router
byte subnet[] = { 255, 255, 255, 0 };                   //subnet mask
Server server(80);                                      //server port
String readString = String(30); //string for fetching data from address
void setup(){
  Ethernet.begin(mac, ip, gateway, subnet);
  Serial.begin(9600);
 tilt.attach(3);
pan.attach(9);
  tilt.write(90);
  pan.write(90);
}
void loop(){
// Create a client connection
Client client = server.available();
  if (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 (c == '\n') {
          if (readString.indexOf("?") <0)
          {
            //do nothing
          }
          else
          {           
             if(readString.indexOf("UP=UP") >0)
               {
                 movetiltupstep();
               }
            else if(readString.indexOf("DN=DN") >0)
               {
                 movetiltdownstep();
               }
             else if(readString.indexOf("LT=LT") >0)
               {
                 movepanleftstep();
               }
             else if(readString.indexOf("RT=RT") >0)
               {
                 movepanrightstep();
               }
             else if(readString.indexOf("CN=CN") >0)
           {
             center();
           }
      }
      // now output HTML data starting with standard header
      client.println("HTTP/1.1 200 OK");
      client.println("Content-Type: text/html");
      client.println();
      //set background to green
      client.print("<body style=background-color:blue>");
      client.println("<hr />");
      client.println("<center>");
      client.println("<h1>Camera control</h1>");
      client.println("<form method=get name=SERVO>");
      client.println("<input type=submit value=UP name=UP style=\"width:100px\"><br>");
      client.println("<input type=submit value=LT name=LT style=\"width:100px\"><input type=submit value=CN name=CN style=\"width:100px\"><input type=submit value=RT name=RT style=\"width:100px\"><br>");
      client.println("<input type=submit value=DN name=DN style=\"width:100px\">");
      client.println("<hr />");
      client.println("<iframe width= 640 height= 360  src= Link[]frameborder= 0  allowfullscreen></iframe>");
      client.println("</form>");
      client.println("</center>");
      client.println("</body></html>");
      //clearing string for next read
      readString="";
      //stopping client
      client.stop();
        }
      }
    }
  }
}
void movetiltupstep(){
  tiltpos = tilt.read();
  Serial.println(tiltpos);
  if (tiltpos >= 66)
  {
  tilt.write(tiltpos - 2);
  }
}
void movetiltdownstep(){
  tiltpos = tilt.read();
  Serial.println(tiltpos);
  if (tiltpos <= 116)
  {
  tilt.write(tiltpos + 2);
  }
}
void movepanleftstep(){
  panpos = pan.read();
  Serial.println(panpos);
  if (panpos >= 4)
  {
  pan.write(panpos - 4);
  }
}
void movepanrightstep(){
  panpos = pan.read();
  Serial.println(panpos);
  if (panpos <= 176)
  {
  pan.write(panpos + 4);
  }
}
void center(){
  panpos = pan.read();
  tiltpos = tilt.read();
  Serial.println(panpos);
  if (panpos < 90)
  {
   for(int i = panpos; i <= 90; i++) {
      pan.write(i);
    }
  }
  else if (panpos > 90)
  {
    for(int i = panpos; i >= 90; i--) {
      pan.write(i);
}
  }
  if (tiltpos < 90)
  {
    for(int i = tiltpos; i <= 90; i++) {
      tilt.write(i);
    }
  }
  else if (tiltpos > 90)
  {
    for(int i = tiltpos; i >= 90; i--) {
      tilt.write(i);
    }
  } 
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T02:01:18+00:00Added an answer on May 31, 2026 at 2:01 am

    Yes, actually, your code cannot work. Let’s put appart the wrong formatting of the line (“Link[]” which is concatenated to “frameborder”), the page that should start with <html>, that you are lucky to be in a very specific case where the Content-Length header is not required and so on, and let’s focus on what you tried to do.

    You tried to do what is called a variable interpolation: you assumed that the variable name “Link[]” in the string will be replaced by another string. It is something that does not exist in C or C++.

    There are several way to do what you want (you can take a look at the String class which exists since Arduino-019 http://arduino.cc/en/Reference/StringObject and what is called concatenation http://arduino.cc/en/Reference/StringConcat).

    In your case, you can simply do that (not tested, but should explain the trick):

    client.print("<iframe width=640 height=360 src=");
    client.print(Link); // Link is not between quotes!
    client.println(" frameborder=0 allowfullscreen></iframe>");
    

    It is less beautiful than what you wanted to do, but it is enough for what you need.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.