Q about dynamically changing Max and Min for analogIn widget

3 views
Skip to first unread message

joshms

unread,
Oct 23, 2014, 5:33:58 PM10/23/14
to netlab-...@googlegroups.com
Hey Phil,

I'm working on a project that requires dynamically changing the Max and Min of an analogIn widget (i.e. not changing the output but rather the output range). Are there particular code hooks to manipulate these attributes?

- Josh

Philip van Allen

unread,
Oct 23, 2014, 7:31:30 PM10/23/14
to netlab-...@googlegroups.com
Hi Josh,

Yes, you can do that. Basically, you can change the value of the text fields in the widget. The text field names are sMin and sMax (as well as sFloor & sCeiling). Note that when you make a change, it will take effect on the next value that comes through the widget. Here's a code snippet to show how:

var max = Number(input0.sMax.text);
var min = Number(input0.sMin.text);
input0.sMax.text = String(max - 10);
input0.sMin.text = String(min + 10);
//sFloor,sCeiling also changeable in the same way

Hope this helps.

.phil
Reply all
Reply to author
Forward
0 new messages