0

I'm receiving data from an Arduino,parsing it using Python and my intent is to update the values in the HTML using the data from serial. Like <h6>value</h6>so the new value will be there when I refresh the page. How to do it?

2
  • What is the result when it is parsed? Commented Mar 17, 2017 at 19:14
  • 4 variables with numeric values Commented Mar 17, 2017 at 19:46

1 Answer 1

1

I'm not sure about your situation but, We use python as the server-side language and for making a dynamic HTML, we use Django Template which is developed for Django (A python based framework). Here's an example of making a simple html with some data:

<!DOCTYPE html>
<html>
 <head>
  <meta name="keywords" content="{{ meta.keywords }}" />
  <meta name="robots" content="index,follow" />
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
  <meta name="HandheldFriendly" content="true"/>

  <title>{{ meta.title}}</title>
  <meta name="description" content="{{ meta.description }}">
  <meta name="og:description" content="{{ meta.description }}">
  <meta property="og:title" content="{{ meta.title }}" />
  <meta property="og:image" content="{{ meta.image_url}}" />
  <meta property="og:image:type" content="image/png" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" charset="utf-8">
</head>
<body>
  <h1>{{ data.title }}</h1>

  <h2>{{ data.description }}</h2>

  {% if data.additional_info %}
   <p>
    {{ data.additional_info }}
   </p>
  {% endif %}

  {% if data.list1|length > 0  %}
   {% for item in data.list1 %}
    <h2>{{ item.title }}</h2>
    <p>
     {{ item.content }}
    </p>
   {% endfor %}
  {% endif %}

 {% if data.list2|length > 0  %}
   {% for item in data.list2 %}
    <h2>{{ item.title }}</h2>
    <p>
      {{ item.content }}
    </p>
  {% endfor %}
{% endif %}

{% if data.list3|length > 0  %}
  {% for item in data.list3 %}
    <h2>{{ item.title }}</h2>
    <p>
       {{ item.content }}
    </p>
   {% endfor %}
 {% endif %}

 </body>
</html>
Sign up to request clarification or add additional context in comments.

1 Comment

So say like I want to upload some images my website's folder, this html file can detect how many images are in there and display the correct number of images?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.