Jump to content
  • 0

How to Truncate an Average Reading Using Scripts


NManteufel

Question

4 answers to this question

Recommended Posts

  • 0

It's not working. This is the full example, I am using the GPIO to switch a relay (HE3621A0500) and the scope to read the signal.

StaticIO.Channel0.DIO[0].text = "1"; // VDD_2V9 CONNECTED
wait(1)  // Allow to stabilize
Scope.single();
if(!Scope.wait()) throw "Stopped";
var average = 0;
var data = Scope.Channel1.data;
data.forEach(function(sample){average += sample;})
average /= data.length;
Math.floor(average * 1000) / 1000;
print("VDD_2V9\t\t\tP4\t\t"+average+" V");
StaticIO.Channel0.DIO[0].text = "0"; // VDD_2V9 DISCONNECTED

 

Edited by NManteufel
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...