Oscilloscope addon: Difference between revisions

Jump to navigation Jump to search
Line 56: Line 56:
Click this button again in order to return to the default continuous sweeps.  
Click this button again in order to return to the default continuous sweeps.  
== Script mode ==
== Script mode ==
Instead of launching the oscilloscope with the {{key press|o}} key and clicking buttons and knobs, it is possible to instantiate the instrument from a Nasal script.<br />
Open the Nasal Console (or the REPL interpreter if you prefer) and execute these lines:
<syntaxhighlight lang="nasal">var Osc = oscilloscope.show.new();
var myFunc = func {return 10+4*math.sin(D2R*int(100*systime()));};
Osc.setTimeBase(0.2);
Osc.setChannelInput(2,'/controls/engines/engine/magnetos');
Osc.setChannelInput(1, myFunc);
Osc.setGain(channel:1, gain:2);
Osc.setGain(channel:2, gain:2);
</syntaxhighlight>
Please note that buttons and knobs are still reacting to manual clickings.<br />
You can explore other nasal instructions like:
<syntaxhighlight lang="nasal">
Osc.setChannelInput(2, func {return 5.5;});
Osc.setChannelInput(1, 'var alt = getprop("/position/altitude-ft"); return alt/10;');
</syntaxhighlight>
== Behind the scene ==


== Related ==
== Related ==
{{Appendix}}
{{Appendix}}
229

edits

Navigation menu