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

Problem with sensor sonar
http://robotc.net/forums/viewtopic.php?f=1&t=4428
Page 1 of 1

Author:  ubik75 [ Thu Apr 05, 2012 12:19 pm ]
Post subject:  Problem with sensor sonar

Hello,

I am french, I have some problem with sensor sonar. When a start program, the value of sensor program is good but after a moment, the sensor sensor falls into default. I see it in the window "NXT Device Control" the sensor value indicates "rangeErr" and after "modeRaw", the value switches from one mode to another.
The program runs en RobotC 3.08 (F/W9.12).

#pragma config(Sensor, S1, touchSensor, sensorTouch)
#pragma config(Sensor, S2, soundSensor, sensorSoundDB)
#pragma config(Sensor, S4, sonarSensor, sensorSONAR)
#pragma config(Motor, motorB, motorB, tmotorNormal, PIDControl, encoder)
#pragma config(Motor, motorC, motorC, tmotorNormal, PIDControl, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//

#define vit 50

task main()
{
// synchro moteur a faire une fois
nMotorEncoder[motorC] = 0;
nMotorEncoder[motorA] = 0;

nSyncedMotors = synchBC; // synchro sur le moteur B qui est maitre

nSyncedTurnRatio = 100;

while(true)
{
motor[motorB] = vit;
if(SensorRaw(sonarSensor) < 20)
{
motor[motorB] = 0;
wait1Msec(500);
motor[motorB] = -vit;
wait1Msec(3000);
gauche();
}
}
}

Thank for your help.

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