PDA

View Full Version : Displaying ADC readings in Portal


kbanks
04-10-2008, 03:08 PM
From a Support thread:

I was wanting to use the script remoteNode.setColumn(name,value) to display the readADC() results. I wrote remoteNode.setColumn(ADC,readADC()) and cannot get it to work. I want ADC to display on the left side in the Node Info tab, and the value of the ADC register to be displayed there. Do I have to do define the ADC somewhere or is there a special place this script is suppose to be placed?

This is a perfect example of a distributed SNAPpy application - by "distributed" I mean an application that is "split" across multiple devices.

Attached are two scripts that show one way to achieve what you are trying to accomplish.

One script runs on a remote node, and takes ADC readings. A second script runs within Portal, and provides a displayAdc() function that the remote node can call.

dp7896
04-11-2008, 02:50 PM
Kevin,

This did not work for me when I uploaded the images. I change the Portal script from :

root.netDb.getNode(remoteAddr).setColumn('ADC', value)

to

remoteNode.setColumn('ADC',value)

and now it works fine. Just thought I would let you know.

admin
04-15-2008, 05:23 PM
I'm glad to hear that you got it working.

As you discovered the remoteNode object is automatically set when a node calls a Portal function. This allows you to do things like you did, setColumn, as well as access any locally stored information about the node.
--Mark