View unanswered posts | View active topics It is currently Fri Mar 22, 2019 2:14 pm

 Page 1 of 1 [ 1 post ]
 Print view Previous topic | Next topic
Problem with this code
Author Message
Rookie

Joined: Fri Apr 26, 2013 11:05 am
Posts: 39
Problem with this code
I have been having my students really get into the programming with RobotC for the VEX. I like to make up challenges which reinforce a particular concept. The current challenge is for students to move toward a mostly empty water bottle, pick it up and place them on top of a 2x4. Four 2x4's enclose the arena area in the shape of a square. Some of the problems we have been having focuses around a robot running a piece of code correctly until a certain point. When a piece of code doesn't work, it isn't making sense as to why. We don't receive any error codes when downloading and usually the piece of code worked earlier in the entire program

I have pasted this code and will point out where the robot doesn't work.

#pragma config(Motor, port1, rightMotor, tmotorVex393_HBridge, openLoop, reversed)
#pragma config(Motor, port6, claw, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port7, arm, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port10, leftMotor, tmotorVex393_HBridge, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

{

motor[claw] = 80; // the claw is opening
wait1Msec(500);

motor[leftMotor] = 75; // motor moving forward
motor[rightMotor] = 58;
wait1Msec(700);

motor[rightMotor]= 0;
motor[leftMotor]=0;

motor[claw]=-15; //the claw is closing
wait1Msec(1000);

motor[arm]= -40; // the elbow is moving up// ***Here is were the code works properly****
wait1Msec(1000);

motor[rightMotor]=50; //motor moving forward
motor[leftMotor]=55;
wait1Msec(425);

motor[rightMotor]= 0;
motor[leftMotor]=0;

motor[arm] = 25; //the elbow is moving down
wait1Msec(500);

motor[arm]=0;
wait1Msec(2000);

motor[claw]=80;//claw is opening
wait1Msec(500);

motor[leftMotor] = 0;
motor[rightMotor] = 0;

motor[leftMotor] = -75; //backing up
motor[rightMotor] = -58;
wait1Msec(1175);

motor[rightMotor]= 55; //swing turn towrds 2nd bottle
motor[leftMotor]=-55;
wait1Msec(520);

motor[rightMotor]=50;
motor[leftMotor]=55;
wait1Msec(475);

motor[rightMotor]=0;
motor[leftMotor]=0;

motor[claw]= -80;
wait1Msec(2500);

motor[claw] = 0;

motor[rightMotor]=40;
motor[leftMotor]=45;
wait1Msec(1000);

motor[arm]= 40; // the elbow is moving up// ***This piece of code only moves the arm upward for about 1/10th of a second.**
wait1Msec(2000);

}

Thank you.

Thu Oct 20, 2016 2:37 pm
Display posts from previous:  Sort by
 Page 1 of 1 [ 1 post ]

#### 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