Control your FT-897 with a python script

Tonight I was wandering if there was a way to control my Yaesu FT-897D with a python script from my Windows machine.. You can also do this from your Linux machine of course ( than use /dev/ttyUSB0 )..

My Yaesu FT-897D was connected to the COM5 of my windows 7 machine.

Keep in mind that you have to downloaded and installed the pySerial. ( pip install pyserial )

The code:

[sourcecode language=”python” wraplines=”false” collapse=”false”]
import serial
import struct
# By David PD7L
# Example to control your Yaesu FT-897
ser = serial.Serial(
port=’COM5′,
baudrate=4800,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_TWO,
bytesize=serial.EIGHTBITS
)
print(ser.isOpen())
# Put the yaesu FT-897 on freq 439.700
data = struct.pack(‘BBBBB’, 0x43, 0x97, 0x00, 0x00, 0x01)
ser.write(data)
# Read ack from the yaesu
s = ser.read(1)
print(s)
ser.close()
[/sourcecode]

Leave a Reply

Your email address will not be published.