View unanswered posts | View active topics It is currently Thu Apr 25, 2019 2:17 pm






Reply to topic  [ 1 post ] 
Program from CS2 summer class fro EV3 Robotc 
Author Message
Rookie

Joined: Tue Aug 19, 2014 12:15 pm
Posts: 37
Post 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);
}


Tue Nov 18, 2014 9:20 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

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.