ROBOTC.net forums
http://www.robotc.net/forums/

Nxt project. Am i doing right? plz check this out
http://www.robotc.net/forums/viewtopic.php?f=1&t=14107
Page 1 of 1

Author:  cskao1114 [ Sat Apr 23, 2016 9:53 am ]
Post subject:  Nxt project. Am i doing right? plz check this out

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:
mindstorm.jpg
mindstorm.jpg [ 85.55 KiB | Viewed 7950 times ]

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