View Full Version : remoteNode.setColumn
dp7896
04-10-2008, 08:42 AM
Hi,
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?
Thanks,
Dave
kbanks
04-10-2008, 01:53 PM
I see three things wrong in what you are trying to do:
1) The biggest thing is that you are mixing up Portal functionality with SNAP Node functionality.
setColumn() is part of the Portal API, readAdc() is a SNAPpy function.
You will need to use two scripts, and split your application between them.
One script will be loaded into Portal, and the other will be loaded into your node.
The script that runs in the SNAP Node will call the readAdc function, and then invoke a separate function within Portal. The Portal script will provide this remote function, and invoke the setColumn function.
2) Maybe this is just a typo in your forum post, but the function is called readAdc, not readADC (and SNAPpy, like "desktop" Python, is case sensitive).
3) Maybe this is just a typo in your forum post, but the readAdc function requires a parameter 0-9 saying which ADC pin to read. Values 0-7 correspond to real pins, values of 8 and 9 access the internal 0 and 3.3 volt references. So it should really be something like readAdc(0).
What you are trying to achieve can be done, and seems like it would make a good example for the SNAPpy script exchange.
Look for a post in that section later today.
mgenti
04-10-2008, 01:54 PM
Dave,
The command remoteNode.setColumn(name,value) actually needs to reside in your Portal script, not in the SNAPpy script. Your SNAPpy script needs to call the function that used the setColumn method with your ADC value passed in.
For example, you could use this function in your Portal script:
def displayAdc(value):
Node3.setColumn('ADC', value)
And in your SNAPpy script you could do:
def reportAdc():
rpc('\x00\x00\x04', 'displayAdc', readAdc(0))
vBulletin® v3.8.0, Copyright ©2000-2012, Jelsoft Enterprises Ltd.