I am trying to get information from the line.
First of all, I had a code to send via serial "t" and I received 3 data lines.
import serial import time port = serial.Serial(port = "/dev/ttyAMA0", baudrate = 115200, timeout = 1) def send_serial(): cde = "t\r" port.write(cde.encode('ascii')) print port.read(9999)
this is what was displayed in the console
HDMI IN CH1 1920x1080p60 RGB HDMI OUT 1920x1080p60 RGB HDMI IN CH2 1920x1080p60 RGB
I want to get every value after CH1
, CH2
and OUT
and without RGB
.
For starters, I tried using this code:
import serial import time port = serial.Serial(port = "/dev/ttyAMA0", baudrate = 115200, timeout = 1) def send_serial(): cde = "t\r" port.write(cde.encode('ascii')) f = port.read(9999) for line in f: if line[0:14] == 'HDMI IN CH1': length = len(line) j = line[12: length -1] print j
But all I get is an empty string.