Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
bdc131fbc6
@ -1,3 +1,5 @@
|
|||||||
|
import platform
|
||||||
|
|
||||||
import serial
|
import serial
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@ -13,8 +15,17 @@ def invia_e_leggi_frase(porta_seriale):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Errore: {e}")
|
print(f"Errore: {e}")
|
||||||
|
|
||||||
|
|
||||||
|
is_win = platform.system().lower() == "windows"
|
||||||
|
|
||||||
|
if is_win:
|
||||||
|
dev="COM5"
|
||||||
|
else:
|
||||||
|
dev = '/dev/ttyUSB0'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ser = serial.Serial('COM5', 9600, timeout=1, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS)
|
ser = serial.Serial(dev, 9600, timeout=1, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS)
|
||||||
if ser.is_open:
|
if ser.is_open:
|
||||||
print(f'Connesso alla porta COM5')
|
print(f'Connesso alla porta COM5')
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user