Jump to content
  • 0

voltmeter script complete example


sergiodorazio

Question

Hi , have you a complete example Voltmeter script ?

I have window Voltmeter that works well in run mode and it read 3.4 Volt.

I need a script that read the voltage value. I run this

 

if(!('Voltmeter' in this)) throw "Please open a Voltmeter";

var vPtt = 0;
var media = 0;

for(var i = 0; i < 10; i++){
    vPtt1 = Voltmeter.Input.Channel1.DC.value;
    media = media + vPtt;
    wait(0.1);
    print("vPtt: "+vPtt+" V");

}
media = media / 10;
var f = File("data.txt");
f.write(media+" voltPtt");

 

the value vPtt is always 0 , why ?

Have you an example ?

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Hi @sergiodorazio

Notice that you place the voltage reading to "vPtt1" and later used "vPtt"

The Voltmeter already performs averaging. The DC is calculated based on average of the specified Update rate.
If you want to average it further, use wait at least this amount of time, like:
wait(Voltmeter.State.Update.value)

Edited by attila
Link to comment
Share on other sites

  • 0

Hi Attila,

very good. Now it'work.

I have an other question : If I have 1 script, from windows command line I can run script by command : "WaveForm.exe myconf.dwf3work -runscript" . How I read in help documentation,  If I have 2 script ,  I use this commands : "WaveForm.exe myconf.dwf3work -script scriptname1" and "WaveForm.exe myconf.dwf3work -script scriptname2" but the script that run is the last script saved in the last configuration and not "scriptname1" or "scriptname2". Can you help me ?

Sergio.

Edited by sergiodorazio
Link to comment
Share on other sites

  • 0

Hi @sergiodorazio

At the time when these arguments where added the Script had no tabs, only one script could exist.

The next WF version (3.16.31) will support selecting the tab, reusing the script argument to load a file, like: WaveForms mywork.dwf3work -script "tab 2"

Edited by attila
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...