View unanswered posts | View active topics It is currently Sun Nov 23, 2014 7:32 am






Reply to topic  [ 5 posts ] 
Newbie...Please...assistance? 
Author Message
Rookie

Joined: Wed Mar 14, 2012 3:11 pm
Posts: 8
Post Newbie...Please...assistance?
Hello...brand new to programming. I'd prefer to learn by example...IF someone would be willing to offer some help? I'm using a PIC with RobotC for IFI. If you could, please provide code to make a robot do the following:

Be fully controlled via the remote control - running 2 motors, tank drive style. Also, I have the the claw mechanism setup to open and close with a motor. I'd like like to drive around, get near an object, and when it's inside the claw, have the claw close on the object automaticaly using the Ultrasonic sensor...which is about 6" behind the claw.

I know this is alot to ask...but if someone is bored, or just looking to help a new person out, I would greatly appreciate your time. I've downloaded the sample programs - testing the Ultrasonic, and remote control...separately..but would really like to combine them in a program. As it stands...I have 2 drive motors connected to Ports 2,3 in motors. Unsure of where to plug in the Ultrasonic, as it has input and output wires.

Thanks very much!


Wed Mar 14, 2012 3:21 pm
Profile
Moderator
Moderator
User avatar

Joined: Tue Sep 14, 2010 9:19 pm
Posts: 496
Post Re: Newbie...Please...assistance?
Welcome to the forums! People are always willing to help you out here (and not because we're bored). I'll get you started with some very basic code:

Code:
//pragmas go here
while(true){
  motor[leftWheel] = vexRT[Ch3];
  motor[rightWheel] = vexRT[Ch2];
  //I don't know how your motors are set up, so you'll probably have to change this by reflecting one of them, or changing the joystick mapping
  if(SensorValue[ultrasonic] < 6){
    motor[claw] = 127;
  }else{
    motor[claw] = 0;
  }
}


That's just some starting code to go off of. I suggest you read through the materials on this page:
http://www.robotc.net/education/curriculum/vex/
And this in particular for your questions about the ultrasonic: http://www.robotc.net/education/curricu ... nic%29.pdf

_________________
sudo rm -rf /


Wed Mar 14, 2012 4:58 pm
Profile
Rookie

Joined: Wed Mar 14, 2012 3:11 pm
Posts: 8
Post Re: Newbie...Please...assistance?
Thanks for taking the time. pragmas...what does that stand for? And what does reflecting a motor mean exactly?


Wed Mar 14, 2012 8:44 pm
Profile
Moderator
Moderator
User avatar

Joined: Tue Sep 14, 2010 9:19 pm
Posts: 496
Post Re: Newbie...Please...assistance?
Take the time to read through this document: http://www.robotc.net/education/curricu ... ndexed.pdf
It will really help you obtain a good understanding of the fundamentals, and answer most of the basic questions that you have.

_________________
sudo rm -rf /


Wed Mar 14, 2012 8:56 pm
Profile
Site Admin
Site Admin

Joined: Tue May 15, 2007 9:02 am
Posts: 406
Post Re: Newbie...Please...assistance?
We have lots of free tutorials online, for learning ROBOTC with the PIC. I think you'll find them helpful: http://www.robotc.net/vex_full/

_________________
Jesse Flot
CMU Robotics Academy
ROBOTC Support


Thu Mar 15, 2012 3:16 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 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.