Answer the question
In order to leave comments, you need to log in
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()
Answer the question
In order to leave comments, you need to log in
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 questionAsk a Question
731 491 924 answers to any question