ROBOTC.net forums
http://robotc.net/forums/

Only Lines 6,7,8 Run on Cortex?
http://robotc.net/forums/viewtopic.php?f=11&t=14572
Page 1 of 1

Author:  ridgerobotics [ Mon May 23, 2016 9:00 am ]
Post subject:  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?

Author:  CARBOT [ Mon May 23, 2016 12:45 pm ]
Post subject:  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.

Author:  ridgerobotics [ Tue May 24, 2016 8:29 am ]
Post subject:  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.

Author:  CARBOT [ Tue May 24, 2016 11:53 am ]
Post subject:  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?

Author:  ridgerobotics [ Tue May 24, 2016 12:11 pm ]
Post subject:  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.

Author:  CARBOT [ Tue May 24, 2016 9:34 pm ]
Post subject:  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
}

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/