View unanswered posts | View active topics It is currently Fri Oct 24, 2014 9:31 am






Reply to topic  [ 3 posts ] 
I need of help with programing 
Author Message
Rookie

Joined: Tue May 14, 2013 5:36 pm
Posts: 1
Post I need of help with programing
Hello I'm currently very new to RobotC, and was hopping if some one could help me with the code for my project I'm working on. I'm just doing something very basic, my robot will just be moving in circles and when it hits an object it will stop and wait for 5 seconds then back up and turn left. Heres what I've coded so far.

#pragma config(Sensor, S2, bumper, sensorTouch)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

task main()
{

while(SensorValue(bumper) == 0)
{

motor[motorA] = 100;
motor[motorC] = 30;

}

motor[motorA] = -50;
motor[motorC] = -50;
wait1Msec(5000);

motor[motorA] = -50
motor[motorC] = 20
wait1Msec(2000);
}

For what ever reason an error pops up at the Wait 5 seconds and anything that is Motor C after the backing up part. Any help will be appreciated.


Tue May 14, 2013 5:44 pm
Profile
Senior Roboticist
User avatar

Joined: Wed Sep 28, 2011 10:13 pm
Posts: 630
Location: If I told you, I'd have to kill you.
Post Re: I need of help with programing
Don't worry, it's a simple fix. :)

Code:
#pragma config(Sensor, S2, bumper, sensorTouch)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

task main()
{

   while(SensorValue(bumper) == 0)
   {

      motor[motorA] = 100;
      motor[motorC] = 30;

   }

   motor[motorA] = -50;
   motor[motorC] = -50;
   wait1Msec(5000);

   motor[motorA] = -50;
   motor[motorC] = 20;
   wait1Msec(2000);
}


You just forgot to put semicolons behind the last two motor control commands. Happens to everyone.

_________________
A.K.A. inxt-generation
Self-proclaimed genius, and future world dominator.
My Brickshelf Folder
"Don't they teach recreational mathematics anymore?" - The Tenth Doctor
Bow down to Nikola Tesla, King of the Geek Gods.


Tue May 14, 2013 5:50 pm
Profile WWW
Expert
User avatar

Joined: Fri Nov 02, 2012 12:07 am
Posts: 164
Location: California, USA
Post Re: I need of help with programing
Problem Solved! :bigthumb: :bigthumb:

_________________
string Robored = "Awesome"
~~Neil Balch~~


Sun Jun 02, 2013 8:57 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 3 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.