Jump to content
Sign in to follow this  
nikosliapis

Help with timers, i'm stuck.

Recommended Posts

nikosliapis

Hello everybody i need the community's help one more time.

I've been working on a project which requires to set some "time stamps" using timerinit() command.

then check each time difference and do stuff.

The problem is that my script doesn't work as expected and i can't figure out the mistake

I know that it is not appropriate to give you a bunch of code and ask you to solve it for me but i don't know what else to do.

I "executed" the script in my head dozens of times, i used all the debuging tricks i knew (msgbox, _arraydisplay, consoleWrite etc), i even used pencil and paper, but with no result.

In order to test the script you must download this:

Arduino Simulator V0.01.au3

then rename this:

timer.txt

to timer.nag (Can't upload a .nag file)

Then execute Arduino Simulator V0.01.au3 and go to file-open and select the timer.nag file

After that press "RUN"

The way it should work is that by pressing the little button "0" it should wait 3 seconds and then turn the "pin 1" to green

by pressing the button "2" it should turn the "pin 4" to green instanly.

The problem is that the script doesn't wait 3 seconds as it should, but the waiting time is random.

The lines of code which i believe the problem is are lines: 166->169 and 181, 182

I believe that the confusion is because i use many "time_stamps", because all the examples i found using timerinit() used just once.

I used the timerinit() command and not the sleep() command because i want to be able to toggle the button "2" while the scripts waits

the 3 seconds after the button "1" is pressed.

I apologise for the coplexity of my request but you are my last hope.

Thanks in advance.


Coding can be fun when you do it your own.

Share this post


Link to post
Share on other sites
martin

Can you give a quick explanation of how you are interpreting the rules? It looks a bit complicated top me.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
nikosliapis

Finally after a lot of testing i managed to get it to work properly. Thank you all for your time.

Script will be soon released in the examples section


Coding can be fun when you do it your own.

Share this post


Link to post
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
Sign in to follow this  

×