View unanswered posts | View active topics It is currently Sat Aug 15, 2020 10:55 am

 Page 1 of 1 [ 6 posts ]
 Print view Previous topic | Next topic
Only Lines 6,7,8 Run on Cortex?
Author Message
Rookie

Joined: Mon May 23, 2016 8:56 am
Posts: 3
Only Lines 6,7,8 Run on Cortex?
We programmed a simple code, and only lines 6,7,8 run?

{

6 motor[port2] = 127;
7 motor[port5] = 127;
8 wait1Msec(500);
9
10 motor[port2] = 127;
11 motor[port5] = 127;
12 wait1Msec(1000);
13
14
15 }

When we load and run the sample programs, only the first part of the code runs, we could use some help here?

Mon May 23, 2016 9:00 am
Expert

Joined: Thu Dec 01, 2011 12:07 am
Posts: 151
Re: Only Lines 6,7,8 Run on Cortex?
I suspect it is working as written but you may have wanted different functionality.
The motor statement starts the motor, it waits, reasserts the same motor value, waits more, and is done.
Consider putting 63 in place of 127 in lines 10 and 11 and see if it runs fast then slow.

Mon May 23, 2016 12:45 pm
Rookie

Joined: Mon May 23, 2016 8:56 am
Posts: 3
Re: Only Lines 6,7,8 Run on Cortex?
No, only lines 6,7,8 run lines 10, 11, 12 don't run.

Both motors start, run for 3 seconds, then stop-that is the problem we ar having.

Tue May 24, 2016 8:29 am
Expert

Joined: Thu Dec 01, 2011 12:07 am
Posts: 151
Re: Only Lines 6,7,8 Run on Cortex?
How do you know lines 10, 11, and 12 do not run?
What functionality were you expecting to have?

Tue May 24, 2016 11:53 am
Rookie

Joined: Mon May 23, 2016 8:56 am
Posts: 3
Re: Only Lines 6,7,8 Run on Cortex?
My expectation is that the two motors will run for .5 second.
Stop.
Then the two motors will run for 1 second.

Right now they run for .5 seconds
Stop.
Nothing happens.

Tue May 24, 2016 12:11 pm
Expert

Joined: Thu Dec 01, 2011 12:07 am
Posts: 151
Re: Only Lines 6,7,8 Run on Cortex?
It does that because you never tell the motors to stop. Try something like this to run for 1 second, be off for 1 second, then run for 1 second.
 Code:task main(){motor[port2] = 127; \\turn motor ONmotor[port5] = 127;\\turn motor ONwait1Msec(1000); \\1 sec delaymotor[port2] = 0; \\turn motor OFFmotor[port5] = 0; \\turn motor OFFwait1Msec(1000); \\1 sec delaymotor[port2] = 127; \\turn motor ONmotor[port5] = 127; \\turn motor ONwait1Msec(1000); \\1 sec delay}

Tue May 24, 2016 9:34 pm
Display posts from previous:  Sort by
 Page 1 of 1 [ 6 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