• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

ESP32 Password Protected Webserver

Q&A Forum › Category: ESP32 › ESP32 Password Protected Webserver
0 Vote Up Vote Down
michaelbennett3443 asked 5 years ago

Hello Rui, I built the password protected webserver from the ESP32 tutorial , The webserver works prefectly, what Im trying to do is add the image from my Arducam to the webserver so that when I access the server to control a device the last image taken by my Arducam is dsiplayed as well. Below Ive posted the code snipet I added to show the cam image, any help you can give with getting the image to show will be appreciated.

When I try to compile the code I get an error

expect primary expression before  ‘<‘ token

Code Snipet:

// Display current state, and ON/OFF buttons for GPIO15

client.println(“<p>Front Blinds – State ” + output15State + “</p>”);

// If the output15State is off, it displays the ON button

if (output15State == “off”) {

client.println(“<p><a href=\”/15/on\”><button class=\”button\”>ON</button></a></p>”);

} else {

client.println(“<p><a href=\”/15/off\”><button class=\”button button2\”>OFF</button></a></p>”);

}

 

// Display current state, and ON/OFF buttons for GPIO16

client.println(“<p>Rear Blinds – State ” + output16State + “</p>”);

// If the output16State is off, it displays the ON button

if (output16State == “off”) {

client.println(“<p><a href=\”/16/on\”><button class=\”button\”>ON</button></a></p>”);

} else {

client.println(“<p><a href=\”/16/off\”><button class=\”button button2\”>OFF</button></a></p>”);

}

 

//ADDED CODE START

client.print(“Camera 1”);

<img src = “http://192.168.1.203/stream”&gt;

 

client.print(“Camera 2”);

<img src = “http://192.168.1.71/stream”&gt;

//ADDED CODE END

client.println(“</body></html>”);

3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 5 years ago

Hi.
That is a syntax error.
I don’t know if it was an issue pasting the code or if you have this wrong – you didn’t close the <img> tag.
You’re missing the “>”.
Additionally, you need to send it inside the client.print() as follows:

client.print("<img src = \“http://192.168.1.203/stream\”>");

You need to write an \ before every “ you want to send to the browser. Otherwise it will think that you’re closing the String.
I’m not sure if this is clear. Tell me if you understand.
Regards,
Sara

0 Vote Up Vote Down
michaelbennett3443 answered 5 years ago

Thank you Sara for the timely response, after I add the edits as you suggested the code works as intended, and yes that was a pasting error on my initial question, Thanks again for the timely help.

0 Vote Up Vote Down
Sara Santos Staff answered 5 years ago

Great!
I’m glad it is working now.
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

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.