View unanswered posts | View active topics It is currently Mon Apr 23, 2018 9:14 pm






Reply to topic  [ 6 posts ] 
Only Lines 6,7,8 Run on Cortex? 
Author Message
Rookie

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

task main()
{

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
Profile
Expert

Joined: Thu Dec 01, 2011 12:07 am
Posts: 151
Post 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
Profile
Rookie

Joined: Mon May 23, 2016 8:56 am
Posts: 3
Post 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
Profile
Expert

Joined: Thu Dec 01, 2011 12:07 am
Posts: 151
Post 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
Profile
Rookie

Joined: Mon May 23, 2016 8:56 am
Posts: 3
Post 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
Profile
Expert

Joined: Thu Dec 01, 2011 12:07 am
Posts: 151
Post 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 ON
motor[port5] = 127;\\turn motor ON
wait1Msec(1000); \\1 sec delay
motor[port2] = 0; \\turn motor OFF
motor[port5] = 0; \\turn motor OFF
wait1Msec(1000); \\1 sec delay
motor[port2] = 127; \\turn motor ON
motor[port5] = 127; \\turn motor ON
wait1Msec(1000); \\1 sec delay
}


Tue May 24, 2016 9:34 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


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

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.