FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

12078 questions

14373 answers

22645 comments

36197 members

0 votes
107 views 0 comments
by
Hi

I'm running a shell script to catch changes in DIN1 pin and then executing some commands.

The catching of the changes need to be rather responsive so I would like to poll the pin about 10 times per second.

So I have a while loop with reading from the gpio.

In most shells I would use

   $ sleep 0.1

somewhere in the loop.  However it seem only to take integer seconds which is way too much.

I need some other mean of creating a pause that does not take all the resources.

If not, I will have to let it run at full speed. But that causes the load average go way above 1.0 which I do not like in the long run.

I can nice it and the load stays at 1.0. But then the responsiveness can be bad when other loads on the RUT are heavy.

So is there an alternative to "sleep" for making a delay?

best

Johan

1 Answer

0 votes
by
Install coreutils-sleep, you'll have the full-featured GNU sleep. From a ssh or CLI console;

opkg update

opkg install coreutils-sleep.

Regards,
Best answer