SoFunction
Updated on 2024-11-15

Calling methods for COM ports in Python

As shown below:

import serial
import time

t = ('com6', 115200) #USB COM number on your PC and the transfer bit rate of the COM port.
print  #Display the working UART port number on your PC.
n = ('logcat -c \r')
n = ('ampclient_samples 2 -O 3 /mnt/media_rw/B278-E25A/video_google_clips/New_Webm/bunny_1080P.webm \r')
(3)
print "Does the stream output normally? Yes=1 or No=2"
Input = int(raw_input())
if Input == 1:
  print "Pass!!!"
  n = (chr(0x03)) #Call for Ctrl+C command in UART port
  n = ('logcat -c \r')
else:
  print "Fail!!!"
  n = (chr(0x03))
  #n = ('logcat -v threadtime /r')

The above method of calling COM port in Python is all that I have shared with you.