File: pv_property_callback.py

package info (click to toggle)
python-pyepics 3.5.9%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,308 kB
  • sloc: python: 10,303; makefile: 109; javascript: 104; sh: 54
file content (14 lines) | stat: -rw-r--r-- 443 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import epics
import time
def onChange(pvname, value, units='x', **kws):
    print(f'PV changed: {pvname}, value={value}, units={units}')

mypc = epics.get_pv('PyTest:ao1.VAL', form='ctrl',
                    auto_monitor=epics.ca.dbr.DBE_VALUE|epics.ca.dbr.DBE_PROPERTY,
                    callback=onChange)

print('Now wait for changes')
expire_time = time.time() + 60.
while time.time() < expire_time:
    time.sleep(0.01)
print('Done.')