javascript - Running Python script from HTML and updating DIV with the output -


the project i'm working consists in reading rfid tag using rfid reader connected arduino , sending id via serial port (usb connection). works when click button on html page.

this first part operational, have python script sends command arduino, reads serial port , print on screen response. takes 5 10 seconds connect arduino, read rfid tag , send value back.

import time import serial import cgi  comport = serial.serial('com3', 9600)  param_caracter = 'a'  time.sleep(1.5) # entre 1.5s 2s  comport.write(param_caracter.encode())  value_serial = ""  while (len(value_serial) < 9):     value_serial = comport.read(11)  #f = open("serial_data.txt","w") #f.write(value_serial) #f.close()  print "<p>" + value_serial + "</p>"  comport.close() 

my problem is: how run script html page, using php or javascript, append value_serial value div when click button?

i've tried codes found on web, none of them executes python file correctly.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -