Note that there are some explanatory texts on larger screens.

plurals
  1. POTurning Motor on Lego NXT returns error 0002EA Type 2
    primarykey
    data
    text
    <p>I a writing a program using <strong>RobotC</strong> for the Lego NXT to imitate the behaviour of a puppy. This section of code is supposed to rotate the head which is connected to motor port 3 and read the value on the ultra sonic sensor. If while the head is turned, the dog is called, it will turn in the direction it was already facing. The following function is called when the ultrasonic sensor reads a value (meaning the robot has come close to a wall):</p> <p>visible</p> <pre><code>void SonarSensor() { int sensorValleft; int sensorValright; bool alreadyTurned = false; int i,j; i = 0; j = 0; motor[1] = 0; motor[2] = 0; motor[3] = -SPEED/2; wait10Msec(15); motor[3] = 0; sensorValleft = SensorValue[3]; while(i&lt;100) { if(SensorValue[4] &gt; 40)//calibrate sound sensor { //turn left motor[1]=SPEED; motor[2] = -SPEED; wait10Msec(25); i = 1000; j = 1000; alreadyTurned = true; } else { i++; wait1Msec(5); } } motor[3] = SPEED/2; wait10Msec(30); motor[3] = 0; sensorValright = SensorValue[3]; while(j&lt;100) { if(SensorValue[3] &gt; 1)//calibrate sound sensor { //turn right motor[1]-=SPEED; motor[2] = SPEED; wait10Msec(25); j = 1000; alreadyTurned = true; } else { j++; wait1Msec(5); } } if(alreadyTurned == false) { if(sensorValleft &gt; sensorValright) { //turn left motor[1]=SPEED; motor[2] = -SPEED; wait10Msec(25); } else { //turn right motor[1]=-SPEED; motor[2] = SPEED; wait10Msec(25); } } </code></pre> <p>}visible</p> <p>When the head (motor[3]) rotates the first time the error 0002EA Type2 appears on the NXT screen. At first we thought it was because we were over-rotating the motor causing it to be obstructed so we tried to play around with the wait times but it made no difference.</p> <p>Any ideas on what causes this error or how to fix it would be appreciated.</p> <p>Thanks, Dominique </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload