I’m trying to use the RS-232 Serial port on my raspberri pi to simply turn on and off my Epson projector. For hardware, I’m using a MAX3232 based RS-232 module with the RX and TX crossed. When I run the following python code I can see a ‘status’ LED blink… so something is happening but there is absolutely no response. Just throwing this out there since someone must have been successful doing something similar. Does anyone see any boneheaded mistakes or have any suggestions? Thanks so much!
> import time
> import serial
>
>
> import time
> import serial
>
>
> ser = serial.Serial(
> port='/dev/ttyAMA0',
> baudrate = 9600,
> parity=serial.PARITY_NONE,
> stopbits=serial.STOPBITS_ONE,
> bytesize=serial.EIGHTBITS,
> timeout=1
> )
>
>
>
> if ser.isOpen():
> ser.close()
> ser.open()
> ser.isOpen()
>
> ser.write("PWR OFF \r".encode())
>
> out = ''
> # let's wait one second before reading output (let's give device time to answer)
> time.sleep(1)
>
> while ser.inWaiting() > 0:
> out += ser.read(40)
>
>
> if out != '':
> print(">>" + out)
>
> ser.close()