function probe_balance(sys, Gi, thresh);

base=[sys, ':'];

v2pv = 'BRD1:CH1:AMP';
v4pv = 'BRD2:CH1:AMP';
dtpv = 'TUNER:C2:LOOP:SUB.J';
period=1;

while (1)
  v2   = lcaGet([base, v2pv]);
  v4   = lcaGet([base, v4pv]);
  err = v2-v4;
  if (abs(err) < thresh) err = 0; end
  out = Gi * err;

  lcaPut([base, dtpv], out);
  pause(period);
end
