ROBOTC.net forumshttp://www.robotc.net/forums/ Line Following avoiding obstacles Project! Somebody help me!http://www.robotc.net/forums/viewtopic.php?f=1&t=14093 Page 1 of 1

Author:  cskao1114 [ Sat Apr 23, 2016 3:26 am ]
Post subject:  Line Following avoiding obstacles Project! Somebody help me!

 Attachment: legomindstrom.jpg [ 66.02 KiB | Viewed 7480 times ]
I'm working on a project (Line Following avoiding obstacles Project) but it kinda really tricky cause I am new to this programming...

I have searched for many things bout how to make robotc program for day and day... I realized its not easy for me to do this... thats why I came here for some help

I will be appreciated if you give me a hand !!! PLZ !!

here is my code and this code is for an attachment that I need to finish

task main()
{

nMotorEncoder[rightMotor] = 0;
nMotorEncoder[leftMotor] = 0;

while(nMotorEncoder[leftMotor] < 500)
{
motor[rightMotor] = 50;
motor[leftMotor] = 50;
}
motor[rightMotor] = 0;
motor[leftMotor] = 0;
wait1Msec(2000);

int threshold = 50;

if(SensorValue(left_light) < 50)
{
if(SensorValue(right_light) > 50)
{
motor[leftMotor] = 0;
motor[rightMotor] = 40;
}
else
{
motor[leftMotor] = 50;
motor[rightMotor] = 50;
}
}

while(SensorValue(sonar) > 10
{
motor[rightMotor] = 55;
motor[leftMotor] = 55;
}

motor[rightMotor] = 0;
motor[leftMotor] = 0;
wait1Msec (1000);

motor[rightMotor] = -20;
motor[leftMotor] = -20;
wait1Msec(500);

motor[rightMotor] = -40;
motor[leftMotor] = 40;
wait1Msec(1500);

motor[rightMotor] = 0;
motor[leftMotor] = 0;
wait1Msec(1000);

nMotorEncoder[rightMotor] = 0;
nMotorEncoder[leftMotor] = 0;

while(nMotorEncoder[leftMotor] < 3000)
{
motor[rightMotor] = 50;
motor[leftMotor] = 50;
}
motor[rightMotor] = 0;
motor[leftMotor] = 0;
wait1Msec(2000);
}

 Attachments: legomindstrom.jpg [ 66.02 KiB | Viewed 7480 times ]

 Page 1 of 1 All times are UTC - 5 hours [ DST ] Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Grouphttp://www.phpbb.com/