title: getting the status of arduino digital pins in webpage
body: <p>I want to read the status of my digital pins of arduino and want to display it
  in web page. For web programming i am using Flask. I tried this code but its not working. from arduino side I am reading the values of 6 digital pins in the form of 1 and 0. How i can do this? Any help would be appreciated.</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  
  
  &lt;h1 style="font-size:30px;font-family:verdana;"&gt;&lt;b&gt;STATUS READ &lt;/h1&gt;&lt;br&gt;&lt;br&gt;
  
  &lt;script src="https://code.jquery.com/jquery-3.1.1.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;p id="#status1"&gt;&lt;/p&gt;
  &lt;p id="#status2"&gt;&lt;/p&gt;
  &lt;p id="#status3"&gt;&lt;/p&gt;
  &lt;p id="#status4"&gt;&lt;/p&gt;
  &lt;p id="#status5"&gt;&lt;/p&gt;
  &lt;p id="#status6"&gt;&lt;/p&gt;
  &lt;script type=text/javascript&gt;
  
  function updatevalues() {
              $SCRIPT_ROOT = {{ request.script_root|tojson|safe }};
              $.getJSON($SCRIPT_ROOT+"/a",
                  function(data) {
                      $("#status1").text(data.m+" %")
                      $("#status2").text(data.n+" %")
                      $("#status3").text(data.o+" %")
                      $("#status4").text(data.p+" %")
                      $("#status5").text(data.q+" %")
                      $("#status6").text(data.r+" %")
  
                  });
          }
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Python code:</p>
  
  <pre><code>from flask import  Flask, render_template,request,redirect, url_for,jsonify,flash
  import flask
  from shelljob import proc
  import math
  import eventlet
  eventlet.monkey_patch()
  from flask import Response
  
  import serial
  import time
  from datetime import datetime
  import json
  import random
  from flask.ext.bootstrap import Bootstrap
  from flask_bootstrap import WebCDN
  
  app = flask.Flask(__name__)
  app.secret_key = 'some_secret'
  bootstrap = Bootstrap(app)
  app.extensions['bootstrap']['cdns']['jquery'] = WebCDN('//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/')
  
  arduino= serial.Serial( '/dev/ttyACM0' , 9600)    #creating object
  
  @app.route('/')
  def home():
      return render_template('status.html')
  
  
  @app.route('/a',methods=['GET'])
  
  def a():
  
    mydata=arduino.readline().split(',')  
    return jsonify(m=float(mydata[0]),n=float(mydata[1]),o=float(mydata[2]),p=float(mydata[3]),q=float(mydata[4]),r=float(mydata[5]))
  
  
  
  if __name__ == "__main__":
      app.run()
  </code></pre>