Running a piece of code for a certain amount of time in C#?
- by Hazem
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!