You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

19 lines
492 B

import time
import serial
import json
ser = serial.Serial(
port='/dev/rfcomm1',
baudrate = 9600,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1
)
while 1:
if(ser.isOpen):
line = ser.readline()
print(line)
b = open("/home/pi/Desktop/test.txt", "a")
b.write(str(line, 'utf-8'))
b.close()