View unanswered posts | View active topics It is currently Thu Sep 18, 2014 7:45 pm






Reply to topic  [ 5 posts ] 
Need help with programmimg an IR seeker 
Author Message
Rookie

Joined: Wed Feb 06, 2013 6:39 pm
Posts: 6
Post Need help with programmimg an IR seeker
The competition is less than a week away and i need to program an ir sensor for the robot. It moves towards the beacon but i cant it to stop. I need help! thanks, Benton.


Thu Feb 07, 2013 8:55 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3223
Location: Rotterdam, The Netherlands
Post Re: Need help with programmimg an IR seeker
Could you please post the code you have so we can see what might be wrong with it?

Also, please don't send PMs to people to ask for help, you'll often get much better help if you post on the forum.

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Thu Feb 07, 2013 12:42 pm
Profile WWW
Rookie

Joined: Wed Feb 06, 2013 6:39 pm
Posts: 6
Post Re: Need help with programmimg an IR seeker
Code:
task main()
{
  while(1 == 1)
  {
    if(SensorValue[IRSeeker2] == 0)
    {
       motor[RightDrive] = 80;
      motor[LeftDrive] = -80;
    }
    if(SensorValue[IRSeeker2] == 5)
    {
      motor[RightDrive] = 0;
      motor[LeftDrive] = 0;
    }
    if(SensorValue[IRSeeker2] == 5)
    {
       motor[Lift] = -60;
       wait1Msec(1000);
    }
    if(SensorValue[IRSeeker2] == 5)
    {
    motor[RightDrive] = 90;
    motor[LeftDrive] = 90;
    }
    if(SensorValue[IRSeeker2] == 5)
    {
       motor[RightDrive] = 0;
       motor[LeftDrive] = 0;
    }
  }
}


Thu Feb 07, 2013 5:55 pm
Profile
Rookie

Joined: Wed Feb 06, 2013 6:39 pm
Posts: 6
Post Re: Need help with programmimg an IR seeker
and ok, thank you


Thu Feb 07, 2013 5:56 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3223
Location: Rotterdam, The Netherlands
Post Re: Need help with programmimg an IR seeker
First of all, you didn't include the whole program, there are no #pragma lines in here. Next time, make sure you put them in too. Second, make sure you surround your code with [ code] [/ code] tags (without the spaces). It will make your code much more readable.
There is nowhere in your robot where you tell it to stop when you're a certain distance away from the object. I have a few questions for you, and you really need to think about them:
* What happens when the object is straight in front (5).
* What happens when the object is to the left (ir seeker returns 1 or 9, depending on how the sensor is mounted)
* What happens when it's a little bit to the right (ir seeker returns 3 or 7, depending on how the sensor is mounted)

To be able to successfully use a sensor, it is important that you understand its behaviour. Reread the page here, especially the introduction part: http://www.hitechnic.com/cgi-bin/commer ... ey=NSK1042

Regards,
Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Fri Feb 08, 2013 12:45 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: BurningLights 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.