In [35]:
import serial
import time
i = 3

In [39]:
path = "/dev/ttyACM1"
nomeArquivo = str(i)
i += 1
ser = serial.Serial(path, 9600)
with open (nomeArquivo, "ab") as fil:
    while True:
        tempo = str(time.time()) + "\t"
        fil.write(str.encode(tempo))
        
        fil.write(ser.readline())


---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-39-629c04fe7e46> in <module>()
      8         fil.write(str.encode(tempo))
      9 
---> 10         fil.write(ser.readline())

/usr/local/lib/python3.5/dist-packages/serial/serialposix.py in read(self, size)
    479             try:
    480                 start_time = time.time()
--> 481                 ready, _, _ = select.select([self.fd], [], [], timeout)
    482                 # If select was used with a timeout, and the timeout occurs, it
    483                 # returns with empty lists -> thus abort read operation.

KeyboardInterrupt: 

In [ ]:


In [ ]: