Running a piece of code for a certain amount of time in C#?
Posted
by Hazem
on Stack Overflow
See other posts from Stack Overflow
or by Hazem
Published on 2010-05-10T13:01:47Z
Indexed on
2010/05/10
13:04 UTC
Read the original article
Hit count: 136
c#
Hi
I am working on a robot that is capable of motion detection using a webcam. I am doing this in C#
The robot moves too fast, so I want to turn it on/off at short time intervals in order to reduce its speed.
For example, it will start the engine then wait 0.5 second and turn it off, this cycle repeats every 2 seconds. This way, its speed wont be too fast. I would like to include this in a single function called Move()
I just don't know how to do this, especially because my motion detection code runs like 20 times a second. Depending on the position of the obstacle, I may need to disable the Move() function and activate other functions that let the robot move into other directions.
Any ideas/suggestions on where am I supposed to start?
Thanks a lot!
© Stack Overflow or respective owner