I do not want the robot to stop until it has timed out, I want the ir sensor to trigger the servo to move during the 5 second run of the robot.

I need a while loop, but where do I put it?How do I make the 5 sec run a condition?I wish my encoders worked.

Sat Jan 11, 2014 8:38 am

MHTS

Guru

Joined: Sun Nov 15, 2009 5:46 amPosts: 1523

Re: multitasking

sprtmed wrote:

I do not want the robot to stop until it has timed out, I want the ir sensor to trigger the servo to move during the 5 second run of the robot.

I need a while loop, but where do I put it?How do I make the 5 sec run a condition?I wish my encoders worked.

Instead of calling wait1Msec(5000) that makes the robot to sleep for 5 seconds and doing nothing else, you need to have the robot just loop and watch the clock until it reaches 5 seconds. While it is watching the clock, it could also watch the IR at the same time. Something like this. BTW, when you compare for equity, you need to use a double equal "==". A single equal is an assignment operator, not a logical compare operator.

How do the encoders not work? Are they not reading correctly? Or is your code not behaving correctly? If so, how did it behave and what was the code?

Sat Jan 11, 2014 3:51 pm

sprtmed

Rookie

Joined: Thu Dec 26, 2013 8:17 pmPosts: 9

Re: multitasking

Thank you again for your quick response. We tried the encoders on my recent "bat out of hell" post. We have a match this weekend and this is my last resort. We will be at the mercy of a battery charge, but I think we can score some points with this method. Trust me in the fact that I redid everything with the encoders. May try again after this coming weekend.

Sun Jan 12, 2014 10:43 am

sprtmed

Rookie

Joined: Thu Dec 26, 2013 8:17 pmPosts: 9

Re: multitasking

Thanks for the help with the code. Did not know what to call the internal timer. We can Score!!!!

Mon Jan 13, 2014 10:47 am

Xandra

Rookie

Joined: Fri Oct 24, 2014 6:51 amPosts: 1

Re: multitasking

There's actually a different command for that. For the instantaneous Tetrix battery level, you use externalBattery. For the average Tetrix battery level, you use externalBatteryAvg.

_________________You can easily check out our high quality sas exam which prepares you well for the real EXIN You can also get success in real University of Toronto exam.

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum