View unanswered posts | View active topics It is currently Thu Jun 21, 2018 10:19 am

 Page 1 of 1 [ 6 posts ]
 Print view Previous topic | Next topic
Author Message
Rookie

Joined: Tue Feb 27, 2007 10:11 am
Posts: 4
Location: Poland
Hi ,
I'm beginner and i have a problem

I have to programme a robot who can follow black line.
When he lost black line he must turn left then right to find line.

I began to write program and it looks that:

{
while(true)

{

if (SensorValue(light) < 40)
{

motor[motorA] = 50;
motor[motorC] = 50;
}

else

{
if (SensorValue(light) > 50)

motor[motorA] = 40;
motor[motorC] = -40;
wait1Msec(250);
}
{
if (SensorValue(light) > 50)
motor[motorA] = -40;
motor[motorC] = 40;
wait1Msec(250);

}
{

if (SensorValue(light) > 50)
motor[motorA] = -40;
motor[motorC] = 40;
wait1Msec(250);
}

{
if (SensorValue(light) > 50)
motor[motorA] = 40;
motor[motorC] = -40;
wait1Msec(250);

}
}
}

And whats wrong?? Pealse for quick ask for ma question.

Tue Feb 27, 2007 10:29 am

Joined: Wed Jan 24, 2007 10:44 am
Posts: 442
Location: Pittsburgh, PA

Here's an example of a line following program.

 Code://*!!Sensor,    S3,          lightsensor, sensorLightActive,      ,              !!*////*!!                                                                            !!*////*!!Start automatically generated configuration code.                           !!*//const tSensors lightsensor          = (tSensors) S3;   //sensorLightActive  //*!!!!*////*!!CLICK to edit 'wizard' created sensor & motor configuration.                !!*//// This program uses the light sensor to track the left side of a linetask main(){   int threshold = 42;   while(true)   {      if(SensorValue[lightsensor] < threshold)      {         motor[motorC]=50;         motor[motorB]=0;      }      else      {         motor[motorC]=0;         motor[motorB]=50;      }   }}

Try that first for the line tracking behavior. You should probably use a timer or an encoder (rotation sensor) in order to track how far it's gone.

In order to use a timer you must first clear it:

 Code:ClearTimer(T1);

and then in a while loop:

 Code:while(time1[T1] < 5000){            //Do something}

Let me know if you have any more questions!

_________________
Vu Nguyen
Software Training Development Team | Webmaster
Need more support? Email ROBOTC Support at support@robotc.net to put in a support ticket

Robotc.net| Robomatter Store | Robotics Academy | CS2N

Tue Feb 27, 2007 10:40 am
Rookie

Joined: Tue Feb 27, 2007 10:11 am
Posts: 4
Location: Poland

I`m was wrong express , the problem is that ,
robot must search black line in right and left.

Tue Feb 27, 2007 4:10 pm

Joined: Wed Jan 24, 2007 10:44 am
Posts: 442
Location: Pittsburgh, PA

 astma_pl wrote:I`m was wrong express , the problem is that , robot must search black line in right and left.

I'm sorry, I don't think I understand. Do you want the robot to rotate left, then right, until it finds a black line? What do you want it to do after that?

_________________
Vu Nguyen
Software Training Development Team | Webmaster
Need more support? Email ROBOTC Support at support@robotc.net to put in a support ticket

Robotc.net| Robomatter Store | Robotics Academy | CS2N

Tue Feb 27, 2007 6:23 pm
Rookie

Joined: Tue Feb 27, 2007 10:11 am
Posts: 4
Location: Poland

I wont to do something like this

Thu Mar 01, 2007 9:45 am
Rookie

Joined: Thu Mar 01, 2007 12:49 pm
Posts: 11

 Quote:I wont to do something like thishttp://www.youtube.com/watch?v=JNprjLI7294

with the “sample program” it should work
Anyway, tomorrow I will work on a different approach to make robot trying to go straight on the line, instead of dancing on it.

Thu Mar 01, 2007 12:54 pm
Display posts from previous:  Sort by
 Page 1 of 1 [ 6 posts ]

#### Who is online

Users browsing this forum: No registered users and 2 guests

 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

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.