Read Serial Data and Log

Easy Python IO
Solve this problem

Write a Python script that reads lines from a serial port and logs them to a file.

Constraints

  • Use pyserial.
  • Log destination: log.txt.
  • Append mode only.
  • Stop after 3 lines.
  • Print each line read.
Starter codePython
1import serial2 3# TODO