File: ca_subscribe.py

package info (click to toggle)
python-pyepics 3.4.1%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,080 kB
  • sloc: python: 11,184; makefile: 106; javascript: 104; sh: 1
file content (20 lines) | stat: -rw-r--r-- 416 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from epics import ca

import time
import sys
import pvnames
mypv = pvnames.updating_pv1

def onChanges(pvname=None, value=None, **kw):
    sys.stdout.write( 'New Value: %s  value=%s, kw=%s\n' %( pvname, str(value), repr(kw)))
    sys.stdout.flush()
    
chid = ca.create_channel(mypv)
eventID = ca.create_subscription(chid, callback=onChanges)

t0 = time.time()
while time.time()-t0 < 15.0:
    time.sleep(0.001)