View unanswered posts | View active topics It is currently Tue Aug 30, 2016 5:08 am

 Page 1 of 1 [ 5 posts ]
 Print view Previous topic | Next topic
Turning on the Light Sensor
Author Message
Rookie

Joined: Sat Feb 15, 2014 8:55 pm
Posts: 3
Turning on the Light Sensor
My FTC team is trying to program a light sensor to illuminate with 40 seconds left in our two minute match.

We've determined that the "wait" value for this to happen would be "wait(80);".

Can anyone help us as far as having the led of the light sensor off until that wait time has elapsed?

Thanks!

Sat Feb 15, 2014 9:01 pm
Guru

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
Re: Turning on the Light Sensor
Don't really understand your scenario. Are you saying you want to lit up the light sensor LED when there are 40 seconds left during the TeleOp period? What is this Wait(80)? There is no "Wait" function in RobotC. There is a wait1Msec or wait10Msec, but there is no "Wait". What is the unit of 80? Why would Wait(80) equivalent to 40 seconds? Any kind of wait statements would pretty much disable your robot for the wait period. Do you really mean to do that?

Sun Feb 16, 2014 4:07 am
Rookie

Joined: Sat Feb 15, 2014 8:55 pm
Posts: 3
Re: Turning on the Light Sensor
While the robot is driving/moving we would want the wait10ms function to use a value equivalent of 80seconds (matches are 120seconds so 40 seconds left would be after 80 seconds).

After that time we would want the sensor to light up.

Sun Feb 16, 2014 12:05 pm
Guru

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1523
Re: Turning on the Light Sensor
Like I said, wait1Msec is not a good idea because it will make your robot sleep for 80 seconds and you will not be able to do anything else. So in your teleop robot loop, you could do something like the following.
 Code:// Turn the light sensor LED off here.ClearTimer(T1);while (true){    if (timer1[T1] >= 80000)    {        // Turn the light sensor LED on here.    }    //    // Do other stuff in TeleOp.    //}

Sun Feb 16, 2014 4:29 pm
Rookie

Joined: Sat Feb 15, 2014 8:55 pm
Posts: 3
Re: Turning on the Light Sensor
Awesome thanks for the tips. That makes alot of sense and helps us understand why earlier autonomous code had the wrong results from our expectations.

Sun Feb 16, 2014 4:56 pm
Display posts from previous:  Sort by
 Page 1 of 1 [ 5 posts ]

Who is online

Users browsing this forum: No registered users and 1 guest

 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

Search for:
 Jump to:  Select a forum ------------------ ROBOTC Applications    ROBOTC for LEGO MINDSTORMS       Third-party sensors    ROBOTC for CORTEX & PIC    ROBOTC for VEX IQ    ROBOTC for Arduino    Robot Virtual Worlds    Multi-Robot Communications    Issues and Bugs Competitions & Partners    Mini Urban Challenge    CS2N Robot Virtual Worlds Competitions       VEX Skyrise Competition 2014-2015       VEX Toss Up 2013-2014       FTC Block Party! 2013-2014    Competitions using VEX - BEST, TSA, VEX, and RoboFest!    FTC Programming    RoboCup Junior and Other ROBOT Competitions Virtual Brick Robotics Discussions    General Discussions    Project Discussions Off-Topic ROBOTC Forum & ROBOTC.net Suggestions/Feedback    ROBOTC Forums Suggestions/Comments    ROBOTC.net Suggestions/Comments       NXT Programming: Tips for Beginning with ROBOTC       VEX Programming: Tips for Beginning with ROBOTC    2013 Robotics Summer Of Learning       VEX Toss Up Programming Challenge       FTC Ring It Up! Programming Challenge    International Forums       Spanish Forums          ROBOTC for MINDSTORMS          ROBOTC for VEX       French Forums          ROBOTC pour Mindstorms          ROBOTC pour IFI VEX       Japanese Forums （日本語のフォーラム）       German Forums    2015 Spring Carnival Event    PLTW (Project Lead The Way)    Robotics Merit Badge    2014 Robotics Academy Summer of Learning