File: pv_added_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 (12 lines) | stat: -rw-r--r-- 339 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
import epics
import time
def onChanges(pvname=None, value=None, char_value=None, **kw):
    print('PV Changed! ', pvname, char_value, time.ctime())

mypv = epics.get_pv('PyTest:ao1.VAL', callback=onChanges)

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