-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.py
53 lines (40 loc) · 1.52 KB
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import qdx
try:
radio = qdx.QDX()
if radio.port:
print('QDX found at ' + radio.port)
except Exception as e:
print(e)
exit()
# Option A: using individual command functions directly
# get vfo a freq
vfo_a_freq = radio.get_vfo_a()
print('VFO A: ' + str(vfo_a_freq / 1000000) + ' MHz')
# get new freq from user
new_freq = float(input('\nEnter new frequency in MHz: ')) * 100000
# set vfo a freq
radio.set_vfo_a(new_freq)
# get vfo a freq to confirm change
new_vfo_a_freq = radio.get_vfo_a()
print('VFO A: ' + str(new_vfo_a_freq / 1000000) + ' MHz')
# reset vfo a freq to original value
input('\nPress enter to reset VFO A...')
radio.set_vfo_a(vfo_a_freq)
vfo_a_freq = radio.get_vfo_a()
print('VFO A: ' + str(vfo_a_freq / 1000000) + ' MHz')
# Option B: using command utility function and tracked settings
# get vfo a freq (no read required, settings are read from the QDX when object is initiallized)
vfo_a_freq = radio.settings['FA']['value']
print('VFO A: ' + str(vfo_a_freq / 1000000) + ' MHz')
# get new freq from user
new_freq = float(input('\nEnter new frequency in MHz: ')) * 100000
# set vfo a freq (new setting is read from QDX automatically to confirm change)
radio.command('FA', new_freq)
# get vfo a freq
vfo_a_freq = radio.settings['FA']['value']
print('VFO A: ' + str(new_vfo_a_freq / 1000000) + ' MHz')
# reset vfo a freq to original value
input('\nPress enter to reset VFO A...')
radio.command('FA', vfo_a_freq)
vfo_a_freq = radio.settings['FA']['value']
print('VFO A: ' + str(vfo_a_freq / 1000000) + ' MHz')