Q
Q
QTVS2015-11-30 19:03:45
Python
QTVS, 2015-11-30 19:03:45

How to send data to the site and so that the site reloads when sent?

import serial

ser = serial.Serial(
    port='COM3',\
    baudrate=9600,\
    parity=serial.PARITY_NONE,\
    stopbits=serial.STOPBITS_ONE,\
    bytesize=serial.EIGHTBITS,\
        timeout=0)

print("connected to: " + ser.portstr)
count=1

while True:
    for line in ser.read():

        print(str(count) + str(': ') + chr(line) )
        count = count+1

ser.close()

Here is the code, it reads the data from the port and then displays it, but how to send it to the site so that when it is sent, the site reloads and it is displayed in the right place?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Michael, 2015-11-30
@QTVS

I see the ideal option as follows:
1. Pull the service when necessary
2. It polls the port and receives data
3. Adds data to redis (or somewhere else)
4. A separate web service returns this data on request
5. Front-end (website either via setInterval) or via some other WebSockets fetches data and displays it even without reloading the page

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question