Welcome to Synthiam!

Program robots using technologies created by industry experts. ARC is our free-to-use robot programming software that makes features like vision recognition, navigation, and artificial intelligence easy.

Get Started
Ecuador
Asked — Edited

Hi! I Need Help Please!

Hi...
Here is the problem..

I am writing an application in C# but I have a problem... I want to stop the task for 3 seconds and continue the task... but the problem is.. I do not know how to do that!
Visual C# has a function called system.treating.tread.sleep() but this function freeze my graphical interface!....

Help!
Thanks!

AI Support Bot
Related Content
Synthiam
PRO
Synthiam
#2  
When you add code to an event of a button, or a Windows.Forms.Timer, they use the GUI thread. For things like pausing and stuff usually requires multi-threading. However, it's not the easiest to learn - so a good hack is to use this function i created for you:

Code:


private void Sleep(int milliSeconds) {

if (milliSeconds < 100)
System.Threading.Thread.Sleep(milliSeconds);
else
for (int x = 0; x < milliSeconds / 100; x++) {

System.Threading.Thread.Sleep(100);
Application.DoEvents();
}
}
#3  
I need to remember this one!
Ecuador
#4  
Ouuu! yeah! a good solution-... i will apply in my project... i am building a transformer with 20 servos:)
Thanks!:)
#5  
Wow , that's slot of servos. No sensors?
#6  
I bet edison's loving the Auto Position feature with that project. I'll be doing the same with the robophilo Sr, six servos per leg, three per arm plus neck and waist movement. The i2c is still available, I'm planning on using the MMA7455 accelerometer on that:) it would be awesome to write an "auto-stand" script to make him release all the servos on the way down when he falls, then automatically stand back up:) The Alderbaran NAO does that already, but I'm not spending $16k lol
Ecuador
#7  
ahhaha! @Kendo4quattro amazing! I love this robots... with legs! with arms! a lot of servos!...
You should upload some photos! ahha! maybe in one months or two months I will finish my new proyect... why? because i want to learn and I am creating my own code from sdk of DJ:)
Ecuador
#8  
@jstarne1 yeahhh a lot of servos... I will use a ultrasonic sensor and maybe a accelerometer... this is the reason why I will use Ez-B with arduino mega !:)
Ecuador
#9  
@DJ Sures your help is working! now I can do a lot of things in C#... wouu! since I started with the sdk of EZ I have learned a lot in this language! thanks Dj:)