Embed youtube html in the webserver example ? solved.

Maybe this is a stupid question, but is it possible to have this code in the arduino? (html is new to me)

//Trying to show an embedded youtube video
client.println("<iframe width="560" height="315" src="http://www.youtube.com/embed/FqPtadgRIKI" frameborder="0" allowfullscreen></iframe>");

here is the complete code:

// ARDUINO WEB DISPLAY, BY PER EMIL SKJOLD

// for W5100 ethernet shield
// the IP address will be dependent on your local network/router
// port 80 is default for HTTP, but can be changed as needed
// use IP address like http://192.168.1.102/ in your brouser
#include <string.h>
#include <SPI.h>
#include <Ethernet.h>

int x=0;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 10, 12 };
Server server(80);

float voltage=0;
float ut=0;



void setup()
{
  // start the server
  Ethernet.begin(mac, ip);
  server.begin();
}

void loop()
{
  // listen for incoming clients
  Client client = server.available();
  if (client) {
     while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        // see if HTTP request has ended with blank line
        if (c == '\n') {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
          
          //meta-refresh page every 2 seconds
          x=x+1;
          client.print("<HEAD>");
          client.print("<meta http-equiv=\"refresh\" content=\"5\">"); //5sek intervall
          client.print("<TITLE />PES Network IO module 1</title>");
          client.print("</head>");
         
          client.println("PES IO module 1");
          client.println("
"); //DENNE MÅ BRUKES FOR Å VISE LINJESKIFT
          client.print("Antall sider sendt: ");
          client.println(x);
          client.println("
");
         // client.println("
");
           
          client.println("--------------------------");
          client.println("
"); //DENNE MÅ BRUKES FOR Å VISE LINJESKIFT
          
        //ANALOGS 
        //TRYKK
        //KONVERTER BYTE TIL NY DEFINISJON
        //map(value, fromLow, fromHigh, toLow, toHigh)
        //bar = map(analogRead(0), 0, 1023, 0, 100);
         client.print("AI0 (Trykk) er ");
         ut = analogRead(0) / 102.3;
         client.print(ut,1); //EN DESIMAL
         client.print(" bar");
         client.println("
"); 
         
         //TEMP LM335
         client.print("AI1 (Temperatur) er ");
        // float Kelvin = (((analogRead(1) / 1023) * 5) * 100);  
        // float Celsius = Kelvin-273;  
        // float Kelvin = analogRead(1) * 0.004882812 * 100;  
        //  float Celsius = Kelvin - 273.15; 
        // InsideTemp.ReadTemp();
       float tempK = analogRead(1) * 0.004882812 * 100;    //Read temperature in Kelvins first
       float tempC = tempK - 273.15 - 5; 
         client.print(tempC,0); //ingen DESIMAL
         client.print(" grader celsius");
         client.println("
"); 
         // Serial.println(Celsius);
         // delay(200);
           
          // output the value of each analog input pin
          for (int analogChannel = 2; analogChannel < 6; analogChannel++) {
            client.print("AI");
            client.print(analogChannel);
            client.print(" er ");
            client.print(analogRead(analogChannel));
           // ut = analogRead(analogChannel) / 102.3; //gjør om enhet 1024 til 10.0bar 
           // client.print(ut,1); //EN DESIMAL
            //client.print(" bar");
            client.println("
");
          }
          
          
                             
         // output the value of each analog input pin
         //for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
         //   client.print("analog input ");
         //   client.print(analogChannel);
         //   client.print(" is ");
         //   client.print(analogRead(analogChannel));
         //   client.println("
");
         //   }
            
            client.println("--------------------------");
            client.println("
"); //DENNE MÅ BRUKES FOR Å VISE LINJESKIFT
            
               // output the value of each digital input pin
          for (int digital = 2; digital < 13; digital++) {
            client.print("DI");
            client.print(digital);
            client.print(" er ");
            client.print(digitalRead(digital));
            client.println("
");
          }
          
            client.println("--------------------------");
            client.println("
"); //DENNE MÅ BRUKES FOR Å VISE LINJESKIFT
            client.println("By Per Emil Skjold");
            client.println("
"); //DENNE MÅ BRUKES FOR Å VISE LINJESKIFT 
            
           //Trying to show an embedded youtube video
            client.println("<iframe width="560" height="315" src="http://www.youtube.com/embed/FqPtadgRIKI" frameborder="0" allowfullscreen></iframe>");
        

            //Trying to show a dial from pachube.com
           // client.println("<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="200" HEIGHT="100" id="gauge"><PARAM NAME="movie" VALUE="http://apps.pachube.com/scaredycat/gauge.swf?xml_source=http%3A//apps.pachube.com/scaredycat/getData.php%3Fm%3D0%26f%3D13667%26s%3D0%26u%3D10%26l%3D0%26n%3D5%26t%3D123%26w%3Dfalse%26c1%3D33FF33%26c2%3DEFE415%26c3%3DEF8B15%26c4%3DFF3333%26in%3Dfalse" /><PARAM NAME="quality" VALUE="high" /><param name="wmode" value="transparent"><param name="allowScriptAccess" value="sameDomain" /><EMBED src="http://apps.pachube.com/scaredycat/gauge.swf?xml_source=http%3A//apps.pachube.com/scaredycat/getData.php%3Fm%3D0%26f%3D13667%26s%3D0%26u%3D10%26l%3D0%26n%3D5%26t%3D123%26w%3Dfalse%26c1%3D33FF33%26c2%3DEFE415%26c3%3DEF8B15%26c4%3DFF3333%26in%3Dfalse" quality="high" wmode="transparent" WIDTH="200" HEIGHT="100" NAME="gauge" allowScriptAccess="sameDomain" swLiveConnect="true" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>");
                   
          break;
           }
        }
    }
    // give the web browser time to receive the data
    delay(1);
    // close the connection:
    client.stop();
  }
}

I get this error no matter what I try : error: expected `)’ before numeric constant
If this where possible, it would be nice. Then I could maybe embed a dial or something from pachube.com apps…
All help is much appreciated.
Per Emil S.

client.println("<iframe width="

Here are the open and close double quotes. The compiler has no idea what to do you the rest of the stuff on that statement.

You need to escape a lot of double quotes in that statement.

You’ve got to escape quotes (") if you want to use them in a print string

client.println("<iframe width=\"560\" height=\"315\" src=\"http://www.youtube.com/embed/FqPtadgRIKI\" frameborder=\"0\" allowfullscreen></iframe>");

[edit - PaulS beat me to it!]

You've got to escape quotes (") if you want to use them in a print string

Another possible option in the html parts is to replace the " with ' which may preclude having to deal with the " issues.

zoomkat:

You’ve got to escape quotes (") if you want to use them in a print string

Another possible option in the html parts is to replace the " with ’ which may preclude having to deal with the " issues.

’ worked :slight_smile: Thank you all.
Here’s the line to embed youtube video on arduino:client.println("<iframe width='560' height='315' src='http://www.youtube.com/embed/FqPtadgRIKI' frameborder='0' allowfullscreen></iframe>");

Here is a video of the result http://www.youtube.com/watch?v=m_IW_qr5S10=en"