Jump to content
  • 0

Substitution for the function "sleep()" for Waveforms script of Analog Discovery 2


AlexMark6

Question

I am writing a script for measuring voltage frequency characteristic of DUT which has delay time by Analog Discovery 2. Then I want to use the java script function "sleep()", but Waveforms script does not accept "sleep()" function. So please teach me the substitution of "sleep()" function for Waveforms script. For example I want to wait 1 sec for each frequency.

By the way I wrote the code below, but it seems to waste CPU resource. So I do not want to use this code.

const d1 = new Date();

while (true) {

    const d2 = new Date();

    if (d2 - d1 > 1000) {

        break;

    }

}

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hi attila

Thank you very much for your quick reply.

Your answer is perfect.  "wait()" function worked well. I am sorry that I did not read "Help". Next time I shall read "Help", then ask.

By the way I write "wait(0.5)", then it seems to wait about 0.5 sec. I will check precisely.

Best regards.

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...