Hey trying to get into use of Sensors for robotc and having issues to where I want the robot to move forward with both motors until the sensor detects less than 20cm in distance from it then to do an odd donut but the code after is able to run both wheels at once where the moving forward only moves the side first inline with the code.

while(SensorValue[Sonar] > distance_in_cm) /* While the Sonar Sensor readings are greater */ /* than the specified, 'distance_in_cm': */ motor[right]= 20; motor[left]= 20; // Motor B is run at a 75 power level // Motor C is run at a 75 power level} motor[left] = 0; motor[right] = 0;

wait1Msec(1000);

motor[left] = 100; motor[right] = -100; wait1Msec(2500);

// Motor B is stopped at a 0 power level

}

Mon Feb 27, 2012 5:34 pm

magicode

Moderator

Joined: Tue Sep 14, 2010 9:19 pmPosts: 496

Re: Hey robotc sensor issue

So what exactly is your question? Can you elaborate on what happens vs what you want to happen?

_________________sudo rm -rf /

Mon Feb 27, 2012 5:58 pm

Casey890

Rookie

Joined: Mon Feb 27, 2012 5:26 pmPosts: 20

Re: Hey robotc sensor issue

Hey thanks but the robot when running the code only runs the first motor in the code sequence but want it to run both. After detecting less than 20cm it is supposed to spin in a circle to show it was less than 20cm both motors are both supposed to run and make the robot spin that part is not the issue just moving towards a wall in a straight line. So it is probably a coding issue and tried to use a sample code from robotc.

Tue Feb 28, 2012 10:06 am

magicode

Moderator

Joined: Tue Sep 14, 2010 9:19 pmPosts: 496

Re: Hey robotc sensor issue

I'm still having trouble understanding what you're trying to say, but does this salve your problem?

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