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

Program from CS2 summer class fro EV3 Robotc
http://robotc.net/forums/viewtopic.php?f=1&t=9839
Page 1 of 1

Author:  ronaldle [ Tue Nov 18, 2014 9:20 am ]
Post subject:  Program from CS2 summer class fro EV3 Robotc

This is the program that was given to the class. The program is suppose to go forward one rotation and then go back one rotation. This one keeps on going forward. It does not turn backward. I hope that I keyed in the correct code.


#pragma config(StandardModel, "EV3_REMBOT")
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

/*------------------------------------------------------------------------------------------------
This program will move your robot forward for 2 seconds. At the end of the program, all motors
will shut down automatically and turn off.

ROBOT CONFIGURATION: LEGO EV3 REM Bot
MOTORS & SENSORS:
[I/O Port] [Name] [Type] [Location]
MotorC leftMotor LEGO EV3 Motor Left side motor
MotorB rightMotor LEGO EV3 Motor Right side motor (reversed)
------------------------------------------------------------------------------------------------*/
task main()
{
//Absolute commands
setMotorTarget(rightMotor,360,50);
setMotorTarget(leftMotor,360,50);
waitUntilMotorStop(leftMotor);
waitUntilMotorStop(rightMotor);

//motor will go 1 rotations forward and 1 rotation backward.
//We are already at 360, so go backward till 360 - 360 = 0
setMotorTarget(rightMotor,0,-50);
setMotorTarget(leftMotor,0,-50);
waitUntilMotorStop(leftMotor);
waitUntilMotorStop(rightMotor);
}

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